# Order of the nodes of an edges

Hello,

in the documentation (https://github.com/graphhopper/graphhopper/blob/master/docs/core/technical.md), it is said that the nodeA is always smaller than the nodeB.
I thought that nodeA corresponds to baseNode in the code, and nodeB corresponds to adjNode.

nodeA and nodeB are how the storage works. baseNode and adjNode are how you traverse the graph and which is the only thing you need to understand if you want to implement some algorithms or work somehow with GraphHopper. E.g. assume this graph:

``````A
|
B-C
``````

if you set the base node to B you get `A` as a first adjNode, calling edgeIterator.next will give you C for the adjNode. But if you start with C as base node you will get B as the only adjNode.

1 Like

Ok thank you!

Just to be sure, i saw two possible cases in calcWeight(EdgeIteratorState edgeState, boolean reverse, int prevOrNextEdgeId ) (in AbstractWeighting)

first case : edgeState.baseNode=A, edgeState.baseNode=B, and reverse = false
second case: edgeState.baseNode=B, edgeState.baseNode=A, and reverse = true

in both cases, we traverse the graph from A to B, am I correct?

for unidirectional algorithms like astar or dijkstra this is true, but not for bidirectional algorithms like dijkstrabi or astarbi. The `reverse` param is true in the latter cases for the āreverseā search from B happening āat the same timeā as the forward search from A. See this blog post for some overview about this topic: https://graphhopper.com/blog/2016/02/08/releasing-graphhopper-0-6/

1 Like