필터 지우기
필터 지우기

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