APOC is a Neo4j extension library of procedures and functions for graph data integration, transformation, analysis, and batch processing. It contains around 450 utilities and is not automatically included with Neo4j. section 5.1.1
For network analysis, apoc.agg.statistics summarizes values such as counts, means, maxima, standard deviations, and percentiles. Applied to relationship counts, it quickly describes a node degree distribution. section 5.1.1
Follower out-degree distribution
Count each user's outgoing FOLLOWS relationships, then return the aggregate statistics. In a 3,594-node follower network, the mean out-degree is about 6.9, the median is 2, and the 90th percentile is 21. section 5.1.1
Listing 5.1 Evaluating the node out-degree distribution with the apoc.agg.statistics function
MATCH (u:User)
WITH u, count{ (u)-[:FOLLOWS]->() } AS outDegree
RETURN apoc.agg.statistics(outDegree)
Run the Cypher listing to calculate and summarize each User node's outgoing FOLLOWS relationships. section 5.1.1
