apoc.stats.degrees

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.

Details

Syntax

apoc.stats.degrees([ relTypes ]) :: (type, direction, total, p50, p75, p90, p95, p99, p999, max, min, mean)

Description

Returns the percentile groupings of the degrees on the NODE values connected by the given RELATIONSHIP types.

Input arguments

Name

Type

Description

relTypes

STRING

The relationship types to calculate the percentile grouping over. If this is empty or omitted, all relationships are used. The default is: ``.

Return arguments

Name

Type

Description

type

STRING

The type of the relationship.

direction

STRING

The direction of the relationship.

total

INTEGER

The total observed relationships.

p50

INTEGER

The 50th percentile grouping.

p75

INTEGER

The 75th percentile grouping.

p90

INTEGER

The 90th percentile grouping.

p95

INTEGER

The 95th percentile grouping.

p99

INTEGER

The 99th percentile grouping.

p999

INTEGER

The 99.9th percentile grouping.

max

INTEGER

The max value.

min

INTEGER

The min value.

mean

FLOAT

The mean value.

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();
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");
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