How to clean a graph layout?

May 18, 2011 at 3:55 PM

Hello!

I need to implement a reset function to clean a visualized graph layout. I tried to set _graphToVisualize = null, the graph layout doesn't update. I tried to create a _graphToVisualize with no vertex, and my application just crashed. Anybody has an idea how I should do?

Thanks!

lys06 

 

 

Jul 11, 2011 at 6:08 PM

My suggestion would be to remove the vertices and edges from the underlying graph.

For example:

 

List<TEdge> elist = Graph.Edges.ToList();
List<TVertex> vlist = Graph.Vertices.ToList();
foreach (var e in elist)
     Graph.RemoveEdge(e);
foreach (var v in vlist)
     Graph.RemoveVertex(v);