Update graph (Graph Theory)?

1 view (last 30 days)
Giuseppe Antonio
Giuseppe Antonio on 15 Nov 2019
Edited: Matt J on 15 Nov 2019
Assuming I have a graph objects G = graph(s, t, weights) and I plotted it with plot(G, "XData", x, "YData", y); hold on;.
If during the program I (interactively) execute a callback function adding new nodes to G, I would like to update the plot.
I already know that I could just add the now and plot everything again, but is there a way to only plot the new nodes/edges?
Thanks in advance.

Accepted Answer

Matt J
Matt J on 15 Nov 2019
Edited: Matt J on 15 Nov 2019
Perhaps like this,
hold on
H = subgraph(G,idx); %new part of graph
plot(H,'Layout','force','XData',___, 'YData',_____)
hold off

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!