liveBook · Manning

Apoc.agg.statistics function

As explained in Graph Algorithms for Data Science

The apoc.agg.statistics function is an APOC procedure that computes summary statistics for a collection of numeric values.

apoc.agg.statistics computes summary statistics for numeric values, including mean, minimum, maximum, standard deviation, and percentile values. It helps inspect graph distributions in Neo4j Browser. section 5.1.1

Analyzing follower out-degree

MATCH (u:User) WITH u, count{ (u)-[:FOLLOWS]->() } AS outDegree RETURN apoc.agg.statistics(outDegree) For 3,594 users, the result reports a mean out-degree of about 6.92, a median of 2, a 90th percentile of 21, and a maximum of 143. section 5.1.1

How Graph Algorithms for Data Science covers it

How deep it goes
Defines returned statistics and demonstrates percentiles, but defers histogram construction to visualization tools.
Examples
Uses follower out-degree and reports a 3,594-node distribution with mean, median, percentiles, and maximum values.
What it assumes
Assumes basic Cypher pattern matching and counting, while demonstrating distribution statistics through a concrete follower network.
What you can do after
Evaluate graph degree distributions by counting relationships and passing the numeric results to apoc.agg.statistics.
How it connects
Connects APOC with Cypher, relationship counting, out-degree distribution, percentiles, and histograms.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.