Let\'s say we have two directed and positive-weighted graphs on one set of vertices (first graph represents for example rail-roads and the second one - bus lanes; vertices a
I don't think it is the best way, but you can create Nodes as follow:
Node:(NodeId, GraphId, correspondenceLeftCount)
(the total number of nodes will be number_of_initial_nodes * number_of_graphs * number_of_correspondences_allowed
)
So:
For edge where GraphId
doesn't change, correspondenceLeftCount
doesn't change neither.
You add a new Edge for correspondance:
(NodeId, Graph1, correspondenceLeftCount)
-> (NodeId, Graph2, correspondenceLeftCount - 1)`
And for the request A->B:
Your start point are (A, graph1, maxCorrespondenceLeftCount)
and (A, graph2, maxCorrespondenceLeftCount)
.
And your end points are (B, graph1, 0)
, ... , (B, graph1, maxCorrespondenceLeftCount)
, (B, graph2, 0)
, ... , (B, graph2, maxCorrespondenceLeftCount)
.
So you may to have to adapt your Dijkstra implementation for the end condition, and to be able to insert more than one start point.