Oh you need to call next()
on the edge iterator, before this its not even in a sane state. With every call to next()
you get the next edge and this way you can traverse all edges.
Getting all edges:
AllEdgesIterator allEdges = graph.getAllEdges();
while (allEdges.next()) {
int adjNode = allEdges.getAdjNode();
int baseNode = allEdges.getBaseNode();
int edgeId = allEdges.getEdge();
}
Getting all edges adjacent to a certain node:
EdgeExplorer exp = graph.getEdgeExplorer();
EdgeIterator iter = exp.setBaseNode(yourNode);
while (iter.next()) {
int adjNode = iter.getAdjNode();
int baseNode = iter.getBaseNode();
int edgeId = iter.getEdge();
}
Using the Path
from the route calculation you can also get all the nodes or edge iterator states on this path: path.calcNodes()
and path.calcEdges()
. Take a look at the code it should be easy to see.