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

3 Ansichten (letzte 30 Tage)
[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 .

Antworten (0)

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by