MATCH (f:Function)
RETURN f.project AS project, f.name AS function, f.file_uid AS file
ORDER BY project, function
LIMIT 100Uses CALLS_FUNCTION edges which represent resolved function-to-function calls
within the same project. CALLS edges point to unresolved Symbol nodes and
are not suitable for coupling metrics.
MATCH (f:Function)
OPTIONAL MATCH (f)<-[:CALLS_FUNCTION]-(inbound:Function)
OPTIONAL MATCH (f)-[:CALLS_FUNCTION]->(outbound:Function)
RETURN f.project AS project,
f.name AS function,
count(DISTINCT inbound) AS fan_in,
count(DISTINCT outbound) AS fan_out
ORDER BY (count(DISTINCT inbound) + count(DISTINCT outbound)) DESC
LIMIT 50MATCH (caller:Function)-[:CALLS_FUNCTION]->(callee:Function)
RETURN callee.project AS project, callee.name AS name, count(caller) AS fan_in
ORDER BY fan_in DESC
LIMIT 20MATCH (f:Function)
WITH f.signature_hash AS sig, collect(f.name) AS names, count(*) AS copies
WHERE copies > 1
RETURN sig, copies, names
ORDER BY copies DESCMATCH (target:Function {name: $symbol})
MATCH p = (caller:Function)-[:CALLS_FUNCTION*1..4]->(target)
WITH caller, min(length(p)) AS hops
RETURN caller.project, caller.name, caller.file_uid, hops
ORDER BY hops, caller.name
LIMIT 100MATCH (f:File)-[:IMPORTS]->(m:Module {name: $module})
RETURN f.project AS project, f.rel_path AS file
ORDER BY project, fileFind symbol names called by functions in both project A and project B:
MATCH (f:Function {project: $project_a})-[:CALLS]->(s:Symbol)
<-[:CALLS]-(g:Function {project: $project_b})
RETURN DISTINCT s.name AS shared_symbol
ORDER BY shared_symbol
LIMIT 50MATCH (n)
RETURN labels(n)[0] AS label, count(n) AS count
ORDER BY count DESCMATCH ()-[r]->()
RETURN type(r) AS rel, count(r) AS count
ORDER BY count DESCRun inline Cypher:
codegraphx query "MATCH (f:Function) RETURN f.name LIMIT 10"Add --safe to enable the write-guard for ad-hoc sessions:
codegraphx query "MATCH (f:Function) RETURN f.name LIMIT 10" --safeRun from a .cypher file:
codegraphx query path/to/query.cypher