[vtkusers] Minimum Spanning Trees Re: Building VTK-BGL algorithms (using cmake)

Aytekin Vargun varguna at gmail.com
Tue Dec 30 10:42:26 EST 2008


Thanks a lot Jeff,
It looks like I had several versions of VTK and this was causing problems.

Now I have another problem. I am trying to use minimum spanning tree
programs. I first tried to use vtkBoostPrimMinimumSpanningTree but I am
getting the following error message:

"The Prim minimal spanning tree filter is still under development...  Use at
your own risk."

I checked where the error message is and then assumed that I was getting
this message since the implementation is not complete yet. But should I
still see some output on the screen?

I then tried to use vtkKruskalMinimumSpanningTree which looks like in better
shape (whose output is a vtkSelectionAlgorithm). But I am failed to display
its output since its output is not a tree but a forest whereas Prim's
version produces a vtkTree . Then how can I display each subtree? One way of
doing this probably is to cast the result to a graph and then display the
resulting graph.

I will greatly appreciate if anyone shares his/her experiences.
Thanks a lot.

Here is a simplified piece of code I am trying to run:

  vtkMutableUndirectedGraph* g=vtkMutableUndirectedGraph::New();

    // This is used for finding minimum-spanning trees
    vtkIntArray* edgeWeightsArr = vtkIntArray::New();
    edgeWeightsArr->SetName("EdgeWeights");

  VTK_CREATE(vtkRenderer, ren);

  VTK_CREATE(vtkPoints, pts);
  g->AddVertex();
  pts->InsertNextPoint(0, 1, 0);
  g->AddVertex();
  pts->InsertNextPoint(0.5, 1, 0);
  g->AddVertex();
  pts->InsertNextPoint(0.25, 0.5, 0);
  g->AddVertex();
  pts->InsertNextPoint(0, 0, 0);
  g->AddVertex();
  pts->InsertNextPoint(0.5, 0, 0);
  g->AddVertex();
  pts->InsertNextPoint(1, 0, 0);
  g->AddVertex();
  pts->InsertNextPoint(0.75, 0.5, 0);
  g->SetPoints(pts);

  g->AddEdge(0, 1);
  edgeWeightsArr->InsertNextValue(1);
  g->AddEdge(0, 2);
  edgeWeightsArr->InsertNextValue(1);
  g->AddEdge(1, 2);
  edgeWeightsArr->InsertNextValue(1);
  g->AddEdge(2, 3);
  edgeWeightsArr->InsertNextValue(1);
  g->AddEdge(2, 4);
  edgeWeightsArr->InsertNextValue(1);
  g->AddEdge(3, 4);
  edgeWeightsArr->InsertNextValue(1);

  g->GetEdgeData()->AddArray(edgeWeightsArr);

  //VTK_CREATE(vtkBoostPrimMinimumSpanningTree,mst);
  VTK_CREATE(vtkBoostKruskalMinimumSpanningTree,mst);
  mst->SetInput(g);
  mst->SetEdgeWeightArrayName("EdgeWeights");
  mst->Update();

  // HOW TO DISPLAY



On Tue, Dec 23, 2008 at 3:14 PM, Jeff Baumes <jeff.baumes at kitware.com>wrote:

> > When I compile the sample file, I get the first error for the following
> > line:
> >   VTK_CREATE(vtkBoostBiconnectedComponents, biconn);
> >
> > (On CMake, I had set VTK_USE_BOOST set to ON when building VTK)
>
> First, make sure that your app is linking against vtkInfovis. If it
> is, it appears that the Boost algorithms are not being compiled into
> the vtkInfovis library you are using. Ensure that the vtkInfovis you
> are linking against is the one in the build where you turned
> VTK_USE_BOOST on. In Visual Studio, you can check your VTK build by
> looking at the source files under vtkInfovis. Make sure the vtkBoost*
> files are there.
>
> Jeff
>



-- 
My web page: http://www.cs.rpi.edu/~vargua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20081230/fe11239b/attachment.htm>


More information about the vtkusers mailing list