Question on using addedge()
Ältere Kommentare anzeigen
How do we use addedge to assign weights to a graph containing edges with multiple edge weigths(Value1 and Value2, in my example)?
tail = [1 2 3 4];
head = [2 3 4 5];
G = graph(tail,head)
G.Edges.Value1 = ones(4,1)
G.Edges.Value2 = zeros(4,1)
G = addedge(G,5,6,1) %I want to assign 1 to Value1 to the new edge created between nodes 5,6
I obtain the following error.
Error using graph/addedge (line 139)
Unable to add weighted edges to an unweighted graph.
Any suggestions?
3 Kommentare
Deepa Maheshvare
am 14 Dez. 2018
Bearbeitet: Deepa Maheshvare
am 14 Dez. 2018
Deepa Maheshvare
am 14 Dez. 2018
Bearbeitet: Deepa Maheshvare
am 14 Dez. 2018
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Graph and Network Algorithms finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!