-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line Graph Approach For dijkstraTRSP #873
Comments
I think you need to create some additional connections in the graph to allow the other paths to be completed. Like create a node 4' that allows other incoming nodes to 4 going to 7 to complete. |
@woodbri I didn't get you. Can you elaborate? |
Ok, so my thought is that when you remove the restricted path 1-4-7, that it breaks other valid paths like: |
I have an alternative approach. Let us take the above example of restriction from Now, let us find the shortest path from The corresponding We'll start from We'll also store the From From So, the valid path can be |
This is an interesting discussion of the problem by the OSRM team. and it might have some ideas on how we can deal with the same problem in pgRouting. Some of the discussion is involves issues about contraction of the graph, and these can be ignored as we are not currently doing that, but there is discussion on how to add paths to the line graph to deal with these issues. |
Considering the sample data given here.
We will try to transform the given sample data graph into its corresponding Line Graph(Edge based graph).
An undirected edge between
A --- B
can be converted into two directed edges fromA -- > B
andB -- > A
.Since the sample graph contains a mixture of directed and undirected edges, we break down each undirected edge into two directed edges.
Each edge in the original graph becomes a node in the transformed graph and the consecutive edges in the original graph form an edge in the transformed graph.
What are
consecutive edges
?Let s(ei) be the starting node and t(ei) be the target node of edge ei.
Edges ei and ej are termed as consecutive edges if t(ei) = s(ej).
One of the doubts I have is what type of edge(directed or undirected) should be placed in the Line graph if the consecutive edges (ei, ej), either of them is an undirected edge and the other one directed.
For example,
edge 13
is a directed edge andedge 15
is undirected so after the transformation, the edge betweennode 13
andnode 15
should be directed or undirected.Similarly, for edge
(2, 4)
,(2, 1)
,(16, 3)
,(5, 8)
,(5, 9)
,(11, 12)
and(14, 12)
.Now, let us consider a restriction from
edge 4
toedge 7
. We need to find the shortest path fromnode 2
tonode 8
.The shortest path passes through the restriction and
Dijkstra
fails to find the alternative path in the original graph. We transform the graph. Due to the transformation, multiple sources and destinations are generated. In order to overcome that, a virtual source and virtual destination is created.Since, there is restriction from
edge 4 - > edge 7
in the original graph, we can remove the directed edge from thenode 4
tonode 7
in the Line graph.Using Dijkstra, we can now find the shortest alternative path.
The problem arises when the restriction is of length more than
2
. For example, Consider the restrictionedge 1 - > edge 4 - > edge 7
in original graph. In this case, the directed edge betweennode 4
andnode 7
cannot be removed since the restriction also depends on the directed edgenode 1
tonode 4
.What can be other alternative approaches to fix this?
References:-
http://geo.fsv.cvut.cz/gdata/2013/pin2/d/dokumentace/line_graph_teorie.pdf
As far as I understand, this paper does not talk about more than
2
length edge restrictions.https://github.com/Project-OSRM/osrm-backend/wiki/Graph-representation
The text was updated successfully, but these errors were encountered: