Add edges to a graph without changing original topology
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Using the example from https://www.mathworks.com/help/matlab/math/modify-nodes-and-edges-of-existing-graph.html.
Consider the following graph
s = [1 1 1 2];
t = [2 3 4 3];
G = graph(s,t)
plot(G)
G = addedge(G,[1 2],[5 5])
hold on
plot(G)
This gives
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271817/image.jpeg)
Is it possible to add new edges to the original (blue) graph without changing its topology? My purpose is to create an animation where I can see additional nodes and edges being added to an initial topology in each iteration. I don't want the topology to change at every iteration.
Thank you!
1 Kommentar
Walter Roberson
am 16 Feb. 2020
By definition, NO, any addition of an edge to a Graph changes its topology.
I wonder if you are instead concerned about the layout of the graph? You can control where the vertices are drawn; see the plot() method for graph()
Antworten (0)
Siehe auch
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!