Graph Statistics
algo.graphSummary
| Property | Value |
|---|---|
Procedure |
|
Category |
Graph Statistics |
Complexity |
CPU |
Min Args |
0 |
Max Args |
2 |
Syntax
CALL algo.graphSummary([relTypes, nodeLabels])
YIELD nodeCount, edgeCount, avgDegree, maxDegree, minDegree, density, isolatedNodes, selfLoops
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
|
String |
No |
all types |
Comma-separated relationship types to include |
|
String |
No |
all labels |
Comma-separated node labels to include |
Yield Fields
| Field | Type | Description |
|---|---|---|
|
Integer |
Total number of vertices |
|
Long |
Total number of edges |
|
Double |
Average degree across all vertices |
|
Integer |
Maximum vertex degree |
|
Integer |
Minimum vertex degree |
|
Double |
Graph density: |
|
Integer |
Number of vertices with degree 0 |
|
Long |
Number of self-loop edges |
Description
Computes a comprehensive one-row statistical summary of the graph. Density is computed as 2E / (V × (V-1)) for undirected graphs (0 for graphs with ≤ 1 node). Self-loops are counted separately. Optionally filters by edge type and/or node label.
Use Cases
-
Quick graph health check and characterization
-
Monitoring graph evolution over time
-
Input validation before running expensive algorithms
Example
CALL algo.graphSummary('KNOWS', 'Person')
YIELD nodeCount, edgeCount, avgDegree, maxDegree, density, isolatedNodes
RETURN nodeCount, edgeCount, avgDegree, maxDegree, density, isolatedNodes