[vtkusers] Casting output of vtkExtractSelection

Jeff Baumes jeff.baumes at kitware.com
Wed Apr 21 13:13:11 EDT 2010


>
> It is an MST algorithm, so the output should definitely be a vtkTree, right?
>

Actually, no. A vtkTree is a "rooted" tree, where there is a root
vertex with directed edges pointing to child vertices. In general, MST
returns a "unrooted" tree, which is simply a graph with no cycles;
there is no specific root. Because of how it's implemented, Prim's
algorithm takes a starting vertex as input, so that algorithm creates
a vtkTree rooted at that vertex. Kruskal's algorithm does not use a
starting vertex, which is why the output is not a vtkTree, but a
selection containing the selected edges in the spanning tree. After
vtkExtractSelectedGraph, you should have a graph with no cycles, so it
is a tree in the graph theoretic sense, but it is not a rooted
vtkTree.

Jeff



More information about the vtkusers mailing list