Run independent queries while using @recurse functionality

Hi,

I noticed an unexpected behavior when using the @recurse functionality to traverse edges between nodes and providing multiple IDs simultaneously. When querying to obtain all cross-references of a node through the edge (is_xref), I expected that the returned results are complete and independent for each input node.

I create a minimal example, the schema and data can be found below.

So the result is complete when you enter one ID to query on (example queries 1 and 2); however, when performing the query simultaneously for both IDs (e.g. “MeSH:C538443” and “MONDO:0007053”), the returned results are not complete for one of them. The query starting from MeSH:C538443 stops when reaching MONDO:0007053 and doesn’t retrieve the cross-references following MONDO:0007053 (so it misses out “GARD:0009709” and “OMIM:102300”). It seems the query doesn’t return child nodes that are already reached with the other ID.

Setting loop:true solves this problem; however, this is not a solution as it will quickly explode the query time. It is a fundamental issue of the database so would there a solution available here either in the schema or query?

Thanks!
Liesbeth


schema

is_xref: uid @reverse @count .
name: string @index(exact, trigram) .

data

{
  set {
    _:GARD_0009709 <name> "GARD:0009709" .
    _:UMLS_C3888109 <name> "UMLS:C3888109" .  
    _:MedGen_C3888109 <name> "MedGen:C3888109" .
    _:OMIM_102300 <name> "OMIM:102300" .
    _:MeSH_C538443 <name> "MeSH:C538443" .
    _:MONDO_0007053 <name> "MONDO:0007053" .  
    
    _:GARD_0009709 <is_xref> _:MONDO_0007053 .
    _:UMLS_C3888109 <is_xref> _:MeSH_C538443 . 
    _:UMLS_C3888109 <is_xref> _:MONDO_0007053 . 
    _:MedGen_C3888109 <is_xref> _:MeSH_C538443 .  
    _:MedGen_C3888109 <is_xref> _:MONDO_0007053 .
    _:OMIM_102300 <is_xref> _:MONDO_0007053 .
    _:MeSH_C538443 <is_xref> _:MONDO_0007053 .
    
    _:MONDO_0007053 <is_xref> _:GARD_0009709 .
    _:MeSH_C538443 <is_xref> _:UMLS_C3888109 . 
    _:MONDO_0007053 <is_xref> _:UMLS_C3888109 . 
    _:MeSH_C538443 <is_xref> _:MedGen_C3888109 .  
    _:MONDO_0007053 <is_xref> _:MedGen_C3888109 .
    _:MONDO_0007053 <is_xref> _:OMIM_102300 .
    _:MONDO_0007053 <is_xref>  _:MeSH_C538443 .
    }
}

Query

One input ID "MeSH:C538443"

{
 xref(func: eq(name,["MeSH:C538443"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Other single input "MONDO:0007053"

{
 xref(func: eq(name,["MONDO:0007053"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Simultaneous query for both “MeSH:C538443” and "MONDO:0007053"

{
 xref(func: eq(name,["MeSH:C538443","MONDO:0007053"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Something seems off to me here. First, I can’t run the first or the second query. It fails with the error recurse queries require that all predicates are specified in one level which makes sense.

I then, modified the query to -

{
 xref(func: eq(name,"MeSH:C538443")) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref
 }
}

But now, I only got two results, MedGen and MONDO. I was expecting to see all the nodes in the result given that there is only one connected component in the graph. While I look into it, could you provide me the following information -

  1. Version of Dgraph that you are running
  2. Whether the provided queries work for you or you get an error as mentioned above?

Just realized that you should use the following schema instead -

is_xref: [uid] @reverse @count .
name: string @index(exact, trigram) .

Hi,

thanks for the quick reply. The database is build on Dgraph v1.0.16. I copied your query and it returns all 6 nodes in the network. Can the fact that it only returns the two results be related to the fact that you are not asking for the “name” to be returned when browsing is_xref?

Indeed I looked into the possibility of just using the suggested schema with the @recurse. However, there is additional information encoded as facets that is directional. For this reason I have implemented it in the presented fashion. The facet information was not included in the example as it was not related to the problem I identified.

Many thanks
Liesbeth

I see. In Dgraph v1.0.16, the schema uid is same as Dgraph 1.1.1 [uid]. That seems fine. I still do not follow your problem. I will copy the result of the queries here, let me know what the issue is.

Query 1

{
 xref(func: eq(name,["MeSH:C538443"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Result 1

{
  "extensions": {
    "server_latency": {
      "parsing_ns": 6996,
      "processing_ns": 7164014,
      "encoding_ns": 486976
    },
    "txn": {
      "start_ts": 18
    }
  },
  "data": {
    "xref": [
      {
        "id": "MeSH:C538443",
        "is_xref": [
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MONDO:0007053",
            "is_xref": [
              {
                "id": "GARD:0009709",
                "is_xref": [
                  {
                    "id": "MONDO:0007053"
                  }
                ]
              },
              {
                "id": "UMLS:C3888109"
              },
              {
                "id": "MedGen:C3888109"
              },
              {
                "id": "OMIM:102300",
                "is_xref": [
                  {
                    "id": "MONDO:0007053"
                  }
                ]
              },
              {
                "id": "MeSH:C538443"
              }
            ]
          }
        ]
      }
    ]
  }
}

Query 2

{
 xref(func: eq(name,["MONDO:0007053"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Result 2

{
  "extensions": {
    "server_latency": {
      "parsing_ns": 7617,
      "processing_ns": 11652958,
      "encoding_ns": 557370
    },
    "txn": {
      "start_ts": 19
    }
  },
  "data": {
    "xref": [
      {
        "id": "MONDO:0007053",
        "is_xref": [
          {
            "id": "GARD:0009709",
            "is_xref": [
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "OMIM:102300",
            "is_xref": [
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MeSH:C538443",
            "is_xref": [
              {
                "id": "UMLS:C3888109"
              },
              {
                "id": "MedGen:C3888109"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          }
        ]
      }
    ]
  }
}

Query 3

{
 xref(func: eq(name,["MeSH:C538443","MONDO:0007053"])) @recurse(depth: 10000, loop : false) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Result 3

{
  "extensions": {
    "server_latency": {
      "parsing_ns": 18841,
      "processing_ns": 6880258,
      "encoding_ns": 495312
    },
    "txn": {
      "start_ts": 20
    }
  },
  "data": {
    "xref": [
      {
        "id": "MeSH:C538443",
        "is_xref": [
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MONDO:0007053"
          }
        ]
      },
      {
        "id": "MONDO:0007053",
        "is_xref": [
          {
            "id": "GARD:0009709",
            "is_xref": [
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443"
              },
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "OMIM:102300",
            "is_xref": [
              {
                "id": "MONDO:0007053"
              }
            ]
          },
          {
            "id": "MeSH:C538443"
          }
        ]
      }
    ]
  }
}

So my question relates to Result 3. I expected that queries simultaneously for both IDs would return the same results basically. But for MeSH:C538443 the nodes “GARD:0009709” and "“OMIM:102300” are not returned. The query stops when it “MONDO:0007053” I suppose because it is a parent itself but here I need to return all relationships from MeSH:C538443 independent of other entry IDs and their relations.

After the query this information needs to be parsed into a correspondence table on my end and currently with the results this is not a complete listing of correspondences.

Thanks
Liesbeth

As far as I understand, the way @recurse works is it starts with given nodes and traverses until it can reach as many nodes as possible. Because in the Query 3, it was able to reach all the nodes, it stopped traversing further. What you want in your case is Query 1 and Query 2 separately. You can run both the queries together by including both the queries in single request. Dgraph can evaluate them in parallel reducing the response time if that is what you are worried about.

I have tried you suggested solution, but it’s not feasible to construct multiple such queries (which in the real database are quite complex) for 1000nd of nodes. I understand your explanation on the @recurse function, but I also noticed this behavior that it seems to traverse the same node and same edges multiple times.

Query

{
 xref(func: eq(name,["MeSH:C538443","MONDO:0007053"])) @recurse(depth: 5, loop : true) {
 id:name 
 is_xref{
  xref:name
  }
 }
}

Output

{
  "extensions": {
    "server_latency": {
      "parsing_ns": 26298,
      "processing_ns": 32704080,
      "encoding_ns": 1897765
    },
    "txn": {
      "start_ts": 40003
    }
  },
  "data": {
    "xref": [
      {
        "id": "MeSH:C538443",
        "is_xref": [
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "MONDO:0007053",
            "is_xref": [
              {
                "id": "UMLS:C3888109",
                "is_xref": [
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MedGen:C3888109",
                "is_xref": [
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "OMIM:102300",
                "is_xref": [
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MeSH:C538443",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "GARD:0009709",
                "is_xref": [
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "id": "MONDO:0007053",
        "is_xref": [
          {
            "id": "UMLS:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "MedGen:C3888109",
            "is_xref": [
              {
                "id": "MeSH:C538443",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "OMIM:102300",
            "is_xref": [
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "MeSH:C538443",
            "is_xref": [
              {
                "id": "UMLS:C3888109",
                "is_xref": [
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MedGen:C3888109",
                "is_xref": [
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MONDO:0007053",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "OMIM:102300"
                      },
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "GARD:0009709"
                      }
                    ]
                  }
                ]
              },
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "id": "GARD:0009709",
            "is_xref": [
              {
                "id": "MONDO:0007053",
                "is_xref": [
                  {
                    "id": "UMLS:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MedGen:C3888109",
                    "is_xref": [
                      {
                        "id": "MeSH:C538443"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "OMIM:102300",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "MeSH:C538443",
                    "is_xref": [
                      {
                        "id": "UMLS:C3888109"
                      },
                      {
                        "id": "MedGen:C3888109"
                      },
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  },
                  {
                    "id": "GARD:0009709",
                    "is_xref": [
                      {
                        "id": "MONDO:0007053"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

I would not expect it to take the same edge back and forth until it reaches the defined depth. Is there a way to avoid this, similarly as the path expander in Neo4j (Neo4j APOC Procedures User Guide) which allows you to specify the uniqueness of nodes and relations while expanding (12.1.4 Uniqueness).

I plan to look into this soon. But until then, feel free to create a feature request on GitHub and we would include it in our roadmap when we can.

If you set loop: true, it would keep traversing the path again and again. You can run one single query for many many nodes while setting loop: false. Constructing such query should be straight forward too, by just replacing the start node.

I understand that there could be some customization that you want to do in the path traversal, which is something we could look at in the future. I can see that is what Neo4J supports too. I am still not sure which exact feature you are interested in here (out of the possible configuration provided by Neo4J). Because, I would just run 1000s of the queries for each node and get the response.