[vtkusers] Disallow multiple graph edges?

Jeff Baumes jeff.baumes at kitware.com
Mon Oct 26 16:00:03 EDT 2009


On Mon, Oct 26, 2009 at 3:23 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

> Is there anything in place to prevent adding the same edge twice? That
> is, if I do this:
>
> vtkMutableUndirectedGraph* G = vtkMutableUndirectedGraph::New();
>  vtkIdType V1 = G->AddVertex();
>  vtkIdType V2 = G->AddVertex();
>  G->AddEdge ( V1, V2 );
>  G->AddEdge ( V1, V2 );
>
> There will now be two edges between V1 and V2. Some algorithms do not
> allow this. Is there a flag anywhere to disallow these duplicate
> edges? Or would I have to get all the edges of V1 and check if any of
> their Destinations are V2 manually every time before adding an edge?
>
>
No, there is no flag to do this. The solution you suggest is the best I can
think of also.

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091026/baddac59/attachment.htm>


More information about the vtkusers mailing list