Recursive Queries

So from my rough understanding (of the complex query :stuck_out_tongue: ). The similar query on dgraph would be:

#  Load the data
mutation{
 set{
  <A> <child> <B> .
  <B> <child> <C> .
  <C> <child> <D> .
  <D> <child> <A> .
  <A> <name> "A" .
  <B> <name> "B" .
  <C> <name> "C" .
  <D> <name> "D" .
 }
}

# Now a query
{
 recurse(id:A) {
  child
  name
 }
}

This should return

{
  "recurse": [
    {
      "child": [
        {
          "child": [
            {
              "child": [
                {
                  "child": [
                    {
                      "name": "A"
                    }
                  ],
                  "name": "D"
                }
              ],
              "name": "C"
            }
          ],
          "name": "B"
        }
      ],
      "name": "A"
    }
  ]
}

This is the current output. We’re working on tagging the node which created the cycle with a flag (So node A would be marked). I hope this is close to the example you have specified with SQL.