Problems while traversing edges from given node


I’m using GraphHopper 0.6 and I meet some problems when I want to traverse edges for a given node.

For simplicity, I have a directed graph like this:

edge1 : A -> B (baseNode = A, adjNode = B)
edge2 : A -> C (baseNode = C, adjNode = A)

What I want is to get all edges, using node A as source node and I expect both edge1 and edge2 are returned, but actually only edge1 is returned. The code I used is:

EdgeExplorer explorer = baseGraph.createEdgeExplorer();
EdgeIterator iter = explorer.setBaseNode(nodeA);; ...

I guess the reason is that in edge2, the baseNode != A which makes it impossible to find edge2.

For edge2 I import it from osm file like this:

<way ...>
    <nd ref="id for A"/>
    <nd ref="id for C"/>
    <tag k="highway" v="tertiary"/>
    <tag k="oneway" v="yes"/>
</way ...>

so my questions are:

  1. What is used to determine the baseNode and adjNode? Is it the order of “nd” in osm? (I guess not?)
  2. For my case, is it possible to return both edge1 and edge2, given node A?
  3. If not, what should I do to achieve this?

Sorry, I misunderstand some concepts here. The code returns all edges (not only the ones using A as source node but also dest node).

I create a new explorer to return only “out” edges:

EdgeExplorer explorer = baseGraph.createEdgeExplorer(new DefaultEdgeFilter(flagEncoder, false, true));

feel free to remove this post :slight_smile: