我认为这不是最好的方法,但您可以按如下方式创建节点:
Node:(NodeId, GraphId, correspondenceLeftCount)
(节点总数为number_of_initial_nodes * number_of_graphs * number_of_correspondences_allowed
)
So:
对于边在哪里GraphId
没有改变,correspondenceLeftCount
也没有改变。
您添加新的 Edge 进行通信:
(NodeId, Graph1, correspondenceLeftCount)
-> (NodeId, Graph2, 对应LeftCount - 1)`
对于请求 A->B:
你的起点是(A, graph1, maxCorrespondenceLeftCount)
and (A, graph2, maxCorrespondenceLeftCount)
.
你的终点是(B, graph1, 0)
, ... , (B, graph1, maxCorrespondenceLeftCount)
, (B, graph2, 0)
, ... , (B, graph2, maxCorrespondenceLeftCount)
.
所以你可能需要调整你的 Dijkstra 实现结束条件,并且能够插入多个起点。