I have the following graph with 4 edges.
tail = [1 2 3 4];
head = [2 3 4 5];
G = graph(tail,head)
G.Edges.Value = zeros(4,1)
[P,d,edgepath] = shortestpath(G,1,3)
G.Edges(edgepath,:).Value = [2 2]
The edge weights are already assigned and I want to modify it later in my code.To assign new weights to the edges between the nodes 1 and 3, I used the command shortestpath to extract the edge numbers;the last line of the code assigns new weights.
I get the following error. Any suggestions on alternate ways of modifying the edge values/weights?
Error using graph/subsasgn (line 45)
Direct editing of edges is not supported. Use addedge or rmedge instead.