FreeMat
|
Section: Visualization Toolkit Infovis Classes
vtkTableToGraph converts a table to a graph using an auxilliary link graph. The link graph specifies how each row in the table should be converted to an edge, or a collection of edges. It also specifies which columns of the table should be considered part of the same domain, and which columns should be hidden.
A second, optional, table may be provided as the vertex table. This vertex table must have one or more domain columns whose values match values in the edge table. The linked column name is specified in the domain array in the link graph. The output graph will only contain vertices corresponding to a row in the vertex table. For heterogenous graphs, you may want to use vtkMergeTables to create a single vertex table.
The link graph contains the following arrays:
(1) The "column" array has the names of the columns to connect in each table row. This array is required.
(2) The optional "domain" array provides user-defined domain names for each column. Matching domains in multiple columns will merge vertices with the same value from those columns. By default, all columns are in the same domain. If a vertex table is supplied, the domain indicates the column in the vertex table that the edge table column associates with. If the user provides a vertex table but no domain names, the output will be an empty graph. Hidden columns do not need valid domain names.
(3) The optional "hidden" array is a bit array specifying whether the column should be hidden. The resulting graph will contain edges representing connections "through" the hidden column, but the vertices for that column will not be present. By default, no columns are hidden. Hiding a column in a particular domain hides all columns in that domain.
The output graph will contain three additional arrays in the vertex data. The "domain" column is a string array containing the domain of each vertex. The "label" column is a string version of the distinct value that, along with the domain, defines that vertex. The "ids" column also contains the distinguishing value, but as a vtkVariant holding the raw value instead of being converted to a string. The "ids" column is set as the vertex pedigree ID attribute.
To create an instance of class vtkTableToGraph, simply invoke its constructor as follows
obj = vtkTableToGraph
The class vtkTableToGraph 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 vtkTableToGraph class.
string = obj.GetClassName ()
int = obj.IsA (string name)
vtkTableToGraph = obj.NewInstance ()
vtkTableToGraph = obj.SafeDownCast (vtkObject o)
obj.AddLinkVertex (string column, string domain, int hidden)
- Add a vertex to the link graph. Specify the column name, the domain name for the column, and whether the column is hidden. obj.ClearLinkVertices ()
- Clear the link graph vertices. This also clears all edges. obj.AddLinkEdge (string column1, string column2)
- Add an edge to the link graph. Specify the names of the columns to link. obj.ClearLinkEdges ()
- Clear the link graph edges. The graph vertices will remain. vtkMutableDirectedGraph = obj.GetLinkGraph ()
- The graph describing how to link the columns in the table. obj.SetLinkGraph (vtkMutableDirectedGraph g)
- The graph describing how to link the columns in the table. obj.LinkColumnPath (vtkStringArray column, vtkStringArray domain, vtkBitArray hidden)
- Links the columns in a specific order. This creates a simple path as the link graph. obj.SetDirected (bool )
- Specify the directedness of the output graph. bool = obj.GetDirected ()
- Specify the directedness of the output graph. obj.DirectedOn ()
- Specify the directedness of the output graph. obj.DirectedOff ()
- Specify the directedness of the output graph. long = obj.GetMTime ()
- Get the current modified time. obj.SetVertexTableConnection (vtkAlgorithmOutput in)
- A convenience method for setting the vertex table input. This is mainly for the benefit of the VTK client/server layer, vanilla VTK code should use e.g:
table_to_graph->SetInputConnection(1, vertex_table->output());