liveBook · Manning

APOC

As explained in Graph Algorithms for Data Science

APOC is a Neo4j extension library providing procedures and functions for graph data integration, transformation, analysis, and batch processing.

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

How Graph Algorithms for Data Science covers it

How deep it goes
Demonstrates one aggregation function through executable Cypher and interprets its statistical output, without surveying the wider library.
Examples
Uses follower-network out-degree and in-degree distributions, statistical tables, histograms, and a NASA mention-and-publication query.
What you can do after
Apply APOC via apoc.agg.statistics to summarize relationship-count distributions in Neo4j.
How it connects
Connects APOC with Neo4j, Cypher, node degree distribution, percentiles, and network visualization.

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.