apoc.stats.degrees

Procedure

apoc.stats.degrees(relTypes STRING) - returns the percentile groupings of the degrees on the NODE values connected by the given RELATIONSHIP types.

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13). For more information, see the Cypher Manual → Parallel runtime.

Signature

apoc.stats.degrees(types =  :: STRING) :: (type :: STRING, direction :: STRING, total :: INTEGER, p50 :: INTEGER, p75 :: INTEGER, p90 :: INTEGER, p95 :: INTEGER, p99 :: INTEGER, p999 :: INTEGER, max :: INTEGER, min :: INTEGER, mean :: FLOAT)

Input parameters

Name Type Default

types

STRING

Output parameters

Name Type

type

STRING

direction

STRING

total

INTEGER

p50

INTEGER

p75

INTEGER

p90

INTEGER

p95

INTEGER

p99

INTEGER

p999

INTEGER

max

INTEGER

min

INTEGER

mean

FLOAT

Usage Examples

The examples in this section are based on the following sample graph:

CREATE (TheMatrix:Movie {title:'The Matrix', released:1999, tagline:'Welcome to the Real World'})
CREATE (Keanu:Person {name:'Keanu Reeves', born:1964})
CREATE (Carrie:Person {name:'Carrie-Anne Moss', born:1967})
CREATE (Laurence:Person {name:'Laurence Fishburne', born:1961})
CREATE (Hugo:Person {name:'Hugo Weaving', born:1960})
CREATE (LillyW:Person {name:'Lilly Wachowski', born:1967})
CREATE (LanaW:Person {name:'Lana Wachowski', born:1965})
CREATE (JoelS:Person {name:'Joel Silver', born:1952})
CREATE
(Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix),
(Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix),
(Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix),
(Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrix),
(LillyW)-[:DIRECTED]->(TheMatrix),
(LanaW)-[:DIRECTED]->(TheMatrix),
(JoelS)-[:PRODUCED]->(TheMatrix);
CALL apoc.stats.degrees();
Table 1. Results
type direction total p50 p75 p90 p95 p99 p999 max min mean

NULL

"BOTH"

7

1

1

1

7

7

7

7

1

1.75

CALL apoc.stats.degrees("ACTED_IN");
Table 2. Results
type direction total p50 p75 p90 p95 p99 p999 max min mean

"ACTED_IN"

"BOTH"

4

1

1

1

4

4

4

4

0

1.0