cypher: how to return distinct relationship types?

Viewed 3236

How to return the distinct relationship types from all paths in cypher?

Example query:

MATCH p=(a:Philosopher)-[*]->(b:SchoolType)
RETURN DISTINCT EXTRACT( r in RELATIONSHIPS(p)| type(r) ) as RelationshipTypes

This returns a collection for each path p.

I would like to return a single collection contain the distinct relationship types across all collections.

Here is a link to a graph gist to run the query-

http://gist.neo4j.org/?7851642

1 Answers
Related