[vtkusers] Copy a vtkDirectedGraph into a vtkUndirectedGraph?

Jeff Baumes jeff.baumes at kitware.com
Mon Dec 7 10:07:40 EST 2009


On Fri, Dec 4, 2009 at 4:19 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> Is there any way to remove the directed-ness of a graph? I want to do:
>
> vtkUndirectedGraph* UG = vtkUndirectedGraph::New();
> UG->ShallowCopy(DirectedGraph);]
>
> but the error is:
> Invalid graph structure for this type of graph.
>
> Do I have to traverse the directed graph and create each edge in the
> new undirected graph?

Yes, that's how it would have to be done. There are structural
differences in how the edges are stored internally, so it isn't as
easy as setting a flag.

Jeff



More information about the vtkusers mailing list