Find paths between one node and a group of nodes

I tested below snippet where P2 expands to more than one node, but it throws variable(P2) should only expand to 1 uid therefore the path to a group of nodes is not supported currently.

path as shortest(from: uid(P1), to: uid(P2)) {
        friend
    }

You would not have to run more queries to find which places, because the places will be in your path. You would need to parse the path extracted to get the relevant stations to which your package has been delivered.

For example if your dummy node is 0x17 then it would have two paths to it via 0x13 and 0x15`.

  "_path_": [
    {
      "_weight_": 2.0, 
      "uid": "0x17", 
      "friend": {
        "uid": "0x13", 
        "friend": {
          "uid": "0x14"
        }
      }
    }, 
    {
      "_weight_": 2.0, 
      "uid": "0x17", 
      "friend": {
        "uid": "0x15", 
        "friend": {
          "uid": "0x14"
        }
      }
    }
  ]
1 Like