apoc.meta.graph.of
Procedure APOC Core
apoc.meta.graph.of({graph}, {config}) - examines a subset of the graph to provide a graph meta information
Signature
apoc.meta.graph.of(graph = {} :: ANY?, config = {} :: MAP?) :: (nodes :: LIST? OF NODE?, relationships :: LIST? OF RELATIONSHIP?)
Config parameters
The procedure support the following config parameters:
name | type | default | description |
---|---|---|---|
sample |
Long |
1000 |
number of nodes to sample per label. See "Sampling" section below. |
maxRels |
Long |
100 |
number of relationships to be analyzed, by type of relationship and start and end label, in order to remove / add relationships incorrectly inserted / not inserted by the sample result. |
addRelationshipsBetweenNodes |
boolean |
true |
number of relationships to sample per relationship type |
Sampling
Because the count stores return an incomplete picture of the data, we have to cross check the results with the actual data to filter out false positives.
We use a subset of the data to analyze by specifying the sample
parameter (1000 by default).
Through this parameter, for each label we split data for each node-label into batches of (total / sample) ± rand
where total
is the total number of nodes with that label and rand
is a number between 0
and total / sample / 10
.
So, we pick a percentage of nodes with that label of roughly sample / total * 100
% to check against.
We pick the first node of each batch, and we analyze the properties and the relationships.
Type of supported input graphs
Type | Description |
---|---|
String |
a Cypher query |
Virtual Graph |
a Virtual Graph returned by |
Map |
a map with two field |
If you have a quite complex Graph, and you want to analyze and get some info about
a specific sub-graph in it, you can leverage the apoc.meta.graph.of
procedure.
So for the given Graph Model:
You can leverage the apoc.meta.graph.of
procedure in this way:
That will extract the Meta Graph of the provided query, with some stats like the count
for each node involved into the query.
If you want more details you can also look at apoc.meta.graph
documentation