Graph Statistics

algo.graphSummary

Property Value

Procedure

algo.graphSummary

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

relTypes

String

No

all types

Comma-separated relationship types to include

nodeLabels

String

No

all labels

Comma-separated node labels to include

Yield Fields

Field Type Description

nodeCount

Integer

Total number of vertices

edgeCount

Long

Total number of edges

avgDegree

Double

Average degree across all vertices

maxDegree

Integer

Maximum vertex degree

minDegree

Integer

Minimum vertex degree

density

Double

Graph density: 2E / (V × (V-1))

isolatedNodes

Integer

Number of vertices with degree 0

selfLoops

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