You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Edges are always loaded from small node index to large node index #6
The all-edge-iterator returns edges in no particular order. The nodes of the edge itself are always A,B where A<B but the API does not make guarantees yet. If you need a specific order you could iterate through the nodes and return the edges via:
for(intn = 0; n < nodes; n++) {
graph.getOutgoing(n);
// OR graph.getEdges(n);
}
This makes sense for an outgoing edge, where fromNode() should give the origin node and node() (which I might have called toNode()) gives the destination node.
But for an incoming edge, I have to switch these two, so the way they work doesn't really correspond to their javadoc definitions. For an incoming edge, the origin node is given by node() and the destination node is given by fromNode().
I see what you mean. It is a bit misleading as I do not mean the direction of an edge, just where we 'picked up' the edge. The EdgeIterator is of course not limited to directed edges ...
Are the javadocs making more sense now? And yes, you'll still have to switch 'start' and 'end' nodes. But these words do not make any sense for undirected edges ...
What would be the meaning of them if the edge is not directed? You can find out how an edge is directed via CarStreetType.isForward(iter.flags()); or isBackward
Basically I want just looking for a simple way to print out all the edges of a directed graph, making clear which node is the source node and which node is the destination node.
The last printEdges() method I posted works (even if baseNode() and node() do not seem very intuitive to me) except that every edge is printed twice---once as an outgoing edge and once as an incoming edge.
even if baseNode() and node() do not seem very intuitive to me
Let me know if you find more intuitive names. Again: having the undirected case in mind. Or would you prefer to just stick with directed edges/roads even in the case they are undirected (ie. not restricted to one way)? Well, I have to think about this last solution.
Activity
karussell commentedon Dec 18, 2012
The all-edge-iterator returns edges in no particular order. The nodes of the edge itself are always A,B where A<B but the API does not make guarantees yet. If you need a specific order you could iterate through the nodes and return the edges via:
agouge commentedon Dec 19, 2012
The following gives correct results, but I still have a question:
This makes sense for an outgoing edge, where
fromNode()should give the origin node andnode()(which I might have calledtoNode()) gives the destination node.But for an incoming edge, I have to switch these two, so the way they work doesn't really correspond to their javadoc definitions. For an incoming edge, the origin node is given by
node()and the destination node is given byfromNode().karussell commentedon Dec 19, 2012
I see what you mean. It is a bit misleading as I do not mean the direction of an edge, just where we 'picked up' the edge. The EdgeIterator is of course not limited to directed edges ...
clarifying #6
karussell commentedon Dec 19, 2012
Are the javadocs making more sense now? And yes, you'll still have to switch 'start' and 'end' nodes. But these words do not make any sense for undirected edges ...
agouge commentedon Dec 19, 2012
The javadoc are clearer now, thanks. Is there any change of adding
sourceNode() : intanddestinationNode() : intmethods?karussell commentedon Dec 19, 2012
What would be the meaning of them if the edge is not directed? You can find out how an edge is directed via CarStreetType.isForward(iter.flags()); or isBackward
agouge commentedon Dec 19, 2012
Basically I want just looking for a simple way to print out all the edges of a directed graph, making clear which node is the source node and which node is the destination node.
The last
printEdges()method I posted works (even ifbaseNode()andnode()do not seem very intuitive to me) except that every edge is printed twice---once as an outgoing edge and once as an incoming edge.agouge commentedon Dec 19, 2012
I just answered my own question: I only need to print all the outgoing edges (or, equivalently, all the incoming edges) of every node in the graph.
I just have to keep in mind the for an incoming edge,
node()means the source node, while for an outgoing edge,node()means the destination node.karussell commentedon Dec 19, 2012
Let me know if you find more intuitive names. Again: having the undirected case in mind. Or would you prefer to just stick with directed edges/roads even in the case they are undirected (ie. not restricted to one way)? Well, I have to think about this last solution.
Merge pull request #6 from graphhopper/improve_instructions
Fix integer overflow bug (graphhopper#6)
mapbox profile specific voice instructions (#3165)
test equals umontreal-diro#6