Community Quality Metrics
algo.modularityScore
| Property | Value |
|---|---|
Procedure |
|
Category |
Community Quality |
Complexity |
CPU |
Min Args |
1 |
Max Args |
2 |
Syntax
CALL algo.modularityScore(communityProperty [, relTypes])
YIELD modularity, communities, edgeCount
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
|
String |
Yes |
— |
Vertex property name holding the community label |
|
String |
No |
all types |
Comma-separated relationship types |
Yield Fields
| Field | Type | Description |
|---|---|---|
|
Double |
Newman-Girvan modularity Q ∈ [-0.5, 1] |
|
Integer |
Number of distinct communities found |
|
Long |
Total number of edges in the graph |
Description
Evaluates the modularity of an existing community partition stored as a vertex property. Formula: Q = Σ_c [ L_c/m − (d_c/(2m))² ], where L_c is the number of internal edges in community c, d_c is the sum of degrees in c, and m is the total number of edges. Returns a single row.
Use Cases
-
Evaluating the output of community detection algorithms
-
Comparing alternative community assignments
-
Graph partition quality benchmarking
Example
CALL algo.modularityScore('community', 'KNOWS')
YIELD modularity, communities, edgeCount
RETURN modularity, communities, edgeCount
References
-
Newman, M. E. J. & Girvan, M. (2004). Finding and evaluating community structure in networks. Physical Review E, 69(2), 026113.
algo.conductance
| Property | Value |
|---|---|
Procedure |
|
Category |
Community Quality |
Complexity |
CPU |
Min Args |
1 |
Max Args |
2 |
Syntax
CALL algo.conductance(communityProperty [, relTypes])
YIELD community, conductance, internalEdges, boundaryEdges, nodeCount
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
|
String |
Yes |
— |
Vertex property name holding the community label |
|
String |
No |
all types |
Comma-separated relationship types |
Yield Fields
| Field | Type | Description |
|---|---|---|
|
Object |
Community label value |
|
Double |
Conductance score (lower = better community) |
|
Integer |
Edges with both endpoints inside the community |
|
Integer |
Edges crossing the community boundary |
|
Integer |
Number of nodes in the community |
Description
Computes the conductance of each community in an existing partition stored as a vertex property. Formula: conductance = cut© / min(vol©, vol(V\C)), where cut© is the number of boundary edges and vol© is the sum of degrees within C. Lower conductance indicates a better-separated community. Returns one row per community.
Use Cases
-
Evaluating community separation quality
-
Identifying poorly-separated or "leaky" communities
-
Graph cut analysis for partitioning algorithms
Example
CALL algo.conductance('community', 'KNOWS')
YIELD community, conductance, internalEdges, boundaryEdges, nodeCount
RETURN community, conductance ORDER BY conductance ASC
References