How to get the length of a edge by its virtual ID?

How can we get the length of a edge by its ID?

graph.getEdgeIteratorState(edge, adjNode).getDistance()

adjNode needs to be one of the adjacent nodes, since the distance does not depend on the direction of the edge it can be any of the two nodes.

1 Like

By the way this is not ideal for two reasons:

  1. it creates a (possibly unnecessary) EdgeIteratorState object, which can lead to excessive garbage collection

  2. since distance is not direction-dependent it should be possible to obtain the distance without knowing the adjNode (currently this is not possible)

This should be possible. See the javadocs :slight_smile:

@param adjNode is the node that will be returned via adjNode(). If adjNode is
Integer.MIN_VALUE then the edge will be returned in the direction of how it is stored

1 Like

edgeMatch.getEdgeState().getDistance() this is also possible right?

What is edgeMatch ?

Oh nice :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.