FreeMat

- Main Page
- Related Pages

vtkMutableUndirectedGraph

Section: Visualization Toolkit Filtering Classes

# Usage

vtkMutableUndirectedGraph is an undirected graph with additional functions for adding vertices and edges. ShallowCopy(), DeepCopy(), CheckedShallowCopy(), and CheckedDeepCopy() will succeed when the argument is a vtkUndirectedGraph or vtkMutableUndirectedGraph.

To create an instance of class vtkMutableUndirectedGraph, simply invoke its constructor as follows

      obj = vtkMutableUndirectedGraph

# Methods

The class vtkMutableUndirectedGraph has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkMutableUndirectedGraph class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkMutableUndirectedGraph = obj.NewInstance ()`
- `vtkMutableUndirectedGraph = obj.SafeDownCast (vtkObject o)`

- `vtkIdType = obj.AddVertex ()` - Adds a vertex to the graph and returns the index of the new vertex.

  Note: In a distributed graph (i.e. a graph whose DistributedHelper is non-null), this routine cannot be used to add a vertex if the vertices in the graph have pedigree IDs, because this routine will always add the vertex locally, which may conflict with the proper location of the vertex based on the distribution of the pedigree IDs.

- `vtkIdType = obj.AddVertex (vtkVariantArray propertyArr)` - Adds a vertex to the graph with associated properties defined in `propertyArr` and returns the index of the new vertex. The number and order of values in `propertyArr` must match up with the arrays in the vertex data retrieved by GetVertexData().

  If a vertex with the given pedigree ID already exists, its properties will be overwritten with the properties in `propertyArr` and the existing vertex index will be returned.

  Note: In a distributed graph (i.e. a graph whose DistributedHelper is non-null) the vertex added or found might not be local. In this case, AddVertex will wait until the vertex can be added or found remotely, so that the proper vertex index can be returned. If you don't actually need to use the vertex index, consider calling LazyAddVertex, which provides better performance by eliminating the delays associated with returning the vertex index.

- `obj.LazyAddVertex ()` - Adds a vertex to the graph.

  This method is lazily evaluated for distributed graphs (i.e. graphs whose DistributedHelper is non-null) the next time Synchronize is called on the helper.

- `obj.LazyAddVertex (vtkVariantArray propertyArr)` - Adds a vertex to the graph with associated properties defined in `propertyArr`. The number and order of values in `propertyArr` must match up with the arrays in the vertex data retrieved by GetVertexData().

  If a vertex with the given pedigree ID already exists, its properties will be overwritten with the properties in `propertyArr`.

  This method is lazily evaluated for distributed graphs (i.e. graphs whose DistributedHelper is non-null) the next time Synchronize is called on the helper.

- `obj.LazyAddEdge (vtkIdType u, vtkIdType v)` - Adds an undirected edge from `u` to `v`, where `u` and `v` are vertex indices.

  This method is lazily evaluated for distributed graphs (i.e. graphs whose DistributedHelper is non-null) the next time Synchronize is called on the helper.

- `obj.LazyAddEdge (vtkIdType u, vtkIdType v, vtkVariantArray propertyArr)` - Adds an undirected edge from `u` to `v`, where `u` and `v` are vertex indices.

  The number and order of values in `propertyArr` must match up with the arrays in the edge data retrieved by GetEdgeData().

  This method is lazily evaluated for distributed graphs (i.e. graphs whose DistributedHelper is non-null) the next time Synchronize is called on the helper.

- `vtkGraphEdge = obj.AddGraphEdge (vtkIdType u, vtkIdType v)` - Variant of AddEdge() that returns a heavyweight `vtkGraphEdge` object. The graph owns the reference of the edge and will replace its contents on the next call to AddGraphEdge().

  Note: This is a less efficient method for use with wrappers. In C++ you should use the faster AddEdge().

- `obj.RemoveVertex (vtkIdType v)` - Removes the vertex from the graph along with any connected edges. Note: This invalidates the last vertex index, which is reassigned to v.
- `obj.RemoveEdge (vtkIdType e)` - Removes the edge from the graph. Note: This invalidates the last edge index, which is reassigned to e.
- `obj.RemoveVertices (vtkIdTypeArray arr)` - Removes a collection of vertices from the graph along with any connected edges.
- `obj.RemoveEdges (vtkIdTypeArray arr)` - Removes a collection of edges from the graph.