How can I reverse an edge in biograph viewer without redrawing the figure?

4 views (last 30 days)
Anurag
Anurag on 13 Apr 2013
I can use the following code to generate a biograph figure and use the handle to directly change the properties of the figure in the Biograph Viewer:
A = [0 1; 0 0]
h=view(biograph(A))
set(h.Nodes,'Color',[.5 .7 1])
Similarly, is there a way to use the handle 'h' to reverse the edge (1,2)? I want to use this code to animate the edge reversal so creating another A matrix and redrawing the biograph is not an option.
When I modified the Nodes properties (like the example code, or the node id), the changes were seen immediately in the Biograph Viewer. However, when I make changes to the edge properties, nothing happens.

Answers (1)

Lucio Cetto
Lucio Cetto on 6 May 2013
You must call the layout engine to redraw graph. This is because in some types of layouts the actual chronological order of the nodes drives the final position of the nodes. However if you are satisfied with the position of the nodes, you may call the dolayout method with the 'PathsOnly' option set to TRUE. This will redraw the edges, leaving the nodes at their current position. If you follow this approach you will need to tune the Scale and LayoutScale if you want to have extra space between the edges and nodes, as the initial layout has.
HTH

Community Treasure Hunt

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

Start Hunting!

Translated by