[vtkusers] Visualizing a vtkGraph
David Doria
daviddoria+vtk at gmail.com
Fri Nov 6 07:33:01 EST 2009
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...
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:
vtkSmartPointer<vtkCircularLayoutStrategy> circular =
vtkSmartPointer<vtkCircularLayoutStrategy>::New();
vtkSmartPointer<vtkGraphLayout> GraphLayout =
vtkSmartPointer<vtkGraphLayout>::New();
GraphLayout->SetInput(G);
GraphLayout->SetLayoutStrategy(circular);
GraphLayout->Update();
vtkSmartPointer<vtkGraphToPolyData> GraphToPolyData =
vtkSmartPointer<vtkGraphToPolyData>::New();
GraphToPolyData->SetInput(GraphLayout->GetOutput());
GraphToPolyData->Update();
vtkSmartPointer<vtkXMLPolyDataWriter> Writer =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
Writer->SetInput(GraphToPolyData->GetOutput());
Writer->SetFileName("SphereGraph.vtp");
Writer->Write();
This produces this file:
http://www.rpi.edu/~doriad/VTK_List/SphereGraph/SphereGraph.vtp
That doesn't look particularly helpful to me... is there supposed to be a
way to interpret this? I'm not sure what GraphLayout does, the docs said
that GraphToPolyData needed the points to be added by vtkGraphLayout. I
actually already have a point for each graph node - is there a way I can add
the actual points so the graph looks like the input point set that I created
the graph from?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091106/a8d2f1d3/attachment.htm>
More information about the vtkusers
mailing list