cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

gds.alpha.shortestPath.stream not drawing relationships between nodes

Configuration: 32 nodes (4 rings) connected with relationships that have 'start' and 'end' properties.

Objective: find the shortest path between 2 nodes when the topology is filtered based on 'start' and 'end' times.

The below code will find the shortest path based per the above objective, however links are not drawn in the GUI display (only the floating nodes are drawn).

How do I get uni-directional relationships (i.e. links) drawn with the nodes?

Thanks,
Scott

CREATE (n:Satellite:green { id: '1', plane: 'green' })
CREATE (n:Satellite:green { id: '2', plane: 'green' })
CREATE (n:Satellite:green { id: '3', plane: 'green' })
CREATE (n:Satellite:green { id: '4', plane: 'green' })
CREATE (n:Satellite:green { id: '5', plane: 'green' })
CREATE (n:Satellite:green { id: '6', plane: 'green' })
CREATE (n:Satellite:green { id: '7', plane: 'green' })
CREATE (n:Satellite:green { id: '8', plane: 'green' })
MATCH (a),(b) WHERE a.id = '162' AND b.id = '161' CREATE (a)-[r:ISL{ direction: "RX", ethA: 2, ethB: 2, topologyStart: 0, topologyEnd: -1 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '161' AND b.id = '12' CREATE (a)-[r:ISL{ direction: "RX", ethA: 3, ethB: 4, topologyStart: 1, topologyEnd: 75 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '161' AND b.id = '13' CREATE (a)-[r:ISL{ direction: "RX", ethA: 4, ethB: 4, topologyStart: 70, topologyEnd: 160 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '161' AND b.id = '14' CREATE (a)-[r:ISL{ direction: "RX", ethA: 3, ethB: 4, topologyStart: 155, topologyEnd: 200 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '162' AND b.id = '15' CREATE (a)-[r:ISL{ direction: "RX", ethA: 3, ethB: 4, topologyStart: 1, topologyEnd: 75 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '162' AND b.id = '16' CREATE (a)-[r:ISL{ direction: "RX", ethA: 4, ethB: 4, topologyStart: 70, topologyEnd: 160 }]->(b) RETURN type(r), r.id
MATCH (a),(b) WHERE a.id = '162' AND b.id = '9' CREATE (a)-[r:ISL{ direction: "RX", ethA: 3, ethB: 4, topologyStart: 155, topologyEnd: 200 }]->(b) RETURN type(r), r.id
CALL gds.graph.create.cypher(
    'graph-1',
    'MATCH (n) RETURN id(n) AS id',
    'MATCH (a)-[r:ISL]->(b) WHERE ((r.topologyStart<=70) AND (r.topologyEnd=-1 OR r.topologyEnd>75)) RETURN id(a) AS source, id(b) AS target, r.ethA as weight, type(r) AS type'
)


MATCH (start:Satellite {id: '1'}), (end:GroundTerminal {id: '161'})
CALL gds.alpha.shortestPath.stream(
  "graph-1",
  {
	startNode: start,
	endNode: end,
	relationshipTypes: ['ISL'],
	relationshipWeightProperty: "weight"
  }
)
YIELD nodeId, cost
RETURN gds.util.asNode(nodeId), nodeId, cost

1 REPLY 1

I don't think you can do this at the moment, only the Yen's shortest path algorithm returns paths - https://neo4j.com/docs/graph-data-science/current/alpha-algorithms/yen-s-k-shortest-path/#algorithms...

GitHub is down right now, but the code is here - https://github.com/neo4j/graph-data-science/

If you have time you could try creating a PR that adds this functionality or add it as an issue and someone will pick it up.

Cheers, Mark