Prev |  | Next

## 7.10. Multirelational (social) graphs

Figure 7.9. Graph

This example shows a multi-relational network between persons and things they like. A multi-relational graph is a graph with more than one kind of relationship between nodes.

Query.

    START me=node:node_auto_index(name = 'Joe')
    MATCH me-[r1:FOLLOWS|LOVES]->other-[r2]->me
    WHERE type(r1)=type(r2)
    RETURN other.name, type(r1)

The query returns people that `FOLLOWS` or `LOVES` `Joe` back.

Result

other.name | type(r1)
--- | ---
3 rows
3 ms
`"Sara"` | `"FOLLOWS"`
`"Maria"` | `"FOLLOWS"`
`"Maria"` | `"LOVES"`

Copyright © 2013 Neo Technology

Prev | Up | Next
| Home |