How can I write cypher query to return the whole graph? to get all paths without a repeating relationship type or node label ?
You generally would not do this. How big is your graph? Is this just for educational purposes?
What specifically do you want returned?
Thanks for responding. I would like to return all nodes and edges only once. For example if I have 450 patient nodes. I only would like to return one patient node label. To show the whole graph, how the nodes are connected to the edges. Is it possible with a cypher query?
I have the below numbers of nodes and edges .
I found this answer
MATCH path = (A)-[*]->(B)
UNWIND nodes(path) AS n
UNWIND relationships(path) AS r
WITH
collect(DISTINCT path) as paths,
collect(DISTINCT n) AS nodes,
collect(DISTINCT r) AS rels
RETURN
[p IN paths | {
nodes: [n IN nodes(p) | id(n)],
rels: [r IN relationships(p) | id(r)]
}] as paths,
reduce(acc={}, n IN nodes | apoc.map.setKey(acc, toString(id(n)), n)) as nodes,
reduce(acc={}, r IN rels | apoc.map.setKey(acc, toString(id(r)), r)) as rels
but I am getting the error Unknown function 'apoc.map.setKey' (line 13, column 31 (offset: 334))
You need to install the apoc library, but the query can be written not to need it. I can provide a solution later
You wrote
if I have 450 patient nodes. I only would like to return one patient node label.
That sounds to me like you are trying to show the graph's schema. There is in-built db.schema.visualization to do just that.