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 Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by