<br><div class="gmail_quote">On Fri, Nov 6, 2009 at 7:33 AM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I am still having a problem with the minimum spanning tree claiming that it is a forest. I wrote a big function to connect the graph so now (according to my code, which I suppose could have a bug) every vertex can be reached from any vertex - but the MST still claims it is a forest...<br>

<br>I then tried to write out the graph so I could visualize it and see if there are any apparent disconnected regions. I did the following:<br></blockquote><div><br></div><div>Why not just visualize the graph in VTK? This is the visualization toolkit after all ...</div>
<div><br></div><div>vtkGraphLayoutView* view = vtkGraphLayoutView::New();</div><div>view-&gt;AddRepresentationFromInput(G);</div><div><br></div><div>view-&gt;ResetCamera();</div><div>view-&gt;Render();</div><div>view-&gt;GetInteractor()-&gt;Start();</div>
<div><br></div><div>The view has a vtkGraphLayout filter inside, and allows you to change the layout strategy (which defaults to a force-directed strategy).</div><div><br></div><div>You can also use vtkBoostConnectedComponents to see if your graph is indeed connected. Just get the output of the filter, extract the vertex array named &quot;component&quot;, and see if the max value is indeed 0.</div>
<div><br></div><div>Jeff</div></div><br>