i want to make a change in "graphshortestpath" function to give bonus to edges in paths that have distance > 2

3 次查看(过去 30 天)
[DIST,PATH,PRED] = GRAPHSHORTESTPATH(G,S) determines the single source shortest paths from node S to all other nodes in the graph G.
the result of this function "graphshortestpath" is [dist,path,pred], where dist is the distance form S"source node" to all other nodes .
i want to make change that : if dist from S to D > 2 "for un directed graph" give each edge in this path a bonus equal to 0.5. else don't make any thing
for example
the adjecency matrix of this graph is g=[0 1 1 0 ; 1 0 1 1 ; 1 1 0 1 ; 0 1 1 0]; and the dist from node 1 to 4 is '4' ,this value > 2 , so i want to give each edge in the path from node 1 to 4 "e12 , e24 " a bonus equal to 0.5 .

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graph and Network Algorithms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by