Reverse edges

Edges are directional. A query can’t traverse an edge in reverse.

There are two choices to query in both directions

  • Add the reverse edge to the schema and add all the reverse edge data.

  • Tell Dgraph to always store the reverse edge using the @reverse keyword in the schema.

Run the schema mutation and Dgraph will compute all the reverse edges. The reverse edge of an_edge is ~an_edge.

In terms of data modeling, some reverse edges always make sense, like boss_of, others like ,friend, are sometimes, but not always bidirectional.

Endpoint: /alter
Response