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
More efficient graph storage via separating shortcuts from edges #111
Separating shortcuts from edges could have some advantages:
This would reduce storage size. Because some fields are not necessary for shortcuts and some not for edges: no edgeIds in normal edges, no dynamic array for shortcuts necessary, no wayGeometry pointer for shortcuts, ...
it would be possible to support multiple vehicles for CH -> multiple prepare calls
To do this we would need to think about some points:
probably we should store shortcuts different than edges as they do not need to be appended later on. E.g. just one block of edges per node
Having multiple profiles in one graph for the world wide case is extreme, so e.g. in the near future the edgeId limit of 2 billion is reached a lot quicker than with one profile per graph. Not if we have multiple, separate shortcut lists (every shortcut list forms a separate LevelGraph with the normal edges)
The refactoring for this will be huge, see #447 and can be summarized as 'use composition instead of inheritance':
there will be a class GraphHopperStorage implements GraphStorage with methods: public Graph getBaseGraph() and T getGraph( Class<T> clazz ) returning e.g. the LevelGraph, later on we can also provide different Weighting to get specific LevelGraph
the DataAccess objects will be moved from GraphHopperStorage into the BaseGraph class (BaseGraph implements Graph)
the LevelGraphImpl (LevelGraphImpl implements LevelGraph) can also handle its DataAccess objects
the interface GraphStorage extends only Storable no longer Graph
LevelGraphStorage will be removed
Some methods of the base graph (like ensureNodeIndex) needs to be propagated to the LevelGraphs, this will be done with a listener mechanic
this opens up the possibility to register other graph extensions like we currently have with the TurnGraphExtension but more dynamically and not e.g. just one. Also the GraphExtensions would then be decoupled from the Graph and reside in the GraphHopperStorage (and should be probably called StorageExtension, not sure)
So this will not only make new things possible (multiple CHs) but also improve the architecture slightly as storage methods (create, loadExisting, flush, ...) are then separated from the traversal ones.
Currently I'm working on it to make it compile and one question I stumbled over is: the separation leads to the following uglier code:
Should I make this possible again and e.g. make GraphHopperStorage still implement the Graph interface and just forward all graph calls to the base graph? E.g.
Except the possibility of returning different graph type with get?
What do you mean here? The base graph could still be returned explicitely via graphHopperStorage.getGraph(Graph.class), also I can imagine to open up this method for more parameters, this is especially necessary for multiple implementations of LevelGraph (multiple CH)
I've already playing around with this forwarding inside GraphHopperStorage and it looks okay, except that the copyTo exists now twice, once for the 'full copy' of the GraphHopperStorage and one method for just copying the Graph, but as the method has different parameter it does not clash. Still this could be a problem in the future. But the convenience is a nice improvement and probably worth the 'risc'.
What do you mean here? The base graph could still be returned explicitely via graphHopperStorage.getGraph(Graph.class), also I can imagine to open up this method for more parameters, this is especially necessary for multiple implementations of LevelGraph (multiple CH)
Essentially I was meaning that forwarding will focus on base graph, right?
Activity
no pre-calculation of weight, for #111 and more compact edges if two …
karussell commentedon Jun 10, 2015
The refactoring for this will be huge, see #447 and can be summarized as 'use composition instead of inheritance':
GraphHopperStorage implements GraphStoragewith methods:public Graph getBaseGraph()andT getGraph( Class<T> clazz )returning e.g. the LevelGraph, later on we can also provide different Weighting to get specific LevelGraphBaseGraph implements Graph)LevelGraphImpl implements LevelGraph) can also handle its DataAccess objectsSo this will not only make new things possible (multiple CHs) but also improve the architecture slightly as storage methods (create, loadExisting, flush, ...) are then separated from the traversal ones.
Currently I'm working on it to make it compile and one question I stumbled over is: the separation leads to the following uglier code:
instead of just:
Should I make this possible again and e.g. make GraphHopperStorage still implement the Graph interface and just forward all graph calls to the base graph? E.g.
Or should we enforce the separation also for the programming flow? Currently I do not see any disadvantages of having the forwarding.
devemux86 commentedon Jun 10, 2015
+1
Except the possibility of returning different graph type with
get?karussell commentedon Jun 10, 2015
What do you mean here? The base graph could still be returned explicitely via graphHopperStorage.getGraph(Graph.class), also I can imagine to open up this method for more parameters, this is especially necessary for multiple implementations of LevelGraph (multiple CH)
I've already playing around with this forwarding inside GraphHopperStorage and it looks okay, except that the copyTo exists now twice, once for the 'full copy' of the GraphHopperStorage and one method for just copying the Graph, but as the method has different parameter it does not clash. Still this could be a problem in the future. But the convenience is a nice improvement and probably worth the 'risc'.
devemux86 commentedon Jun 10, 2015
Essentially I was meaning that forwarding will focus on base graph, right?
karussell commentedon Jun 10, 2015
Yes, the Graph implementation of GraphHopperStorage would 'behave' exactly like the base graph due to the forwarding
karussell commentedon Jul 3, 2015
Closing in favour of #447
merged #111