MCPcopy Create free account
hub / github.com/Kitware/VTK / AddLinkEdge

Method AddLinkEdge

Infovis/Core/vtkTableToGraph.cxx:188–222  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

186
187//------------------------------------------------------------------------------
188void vtkTableToGraph::AddLinkEdge(const char* column1, const char* column2)
189{
190 if (!column1 || !column2)
191 {
192 vtkErrorMacro("Column names may not be null.");
193 }
194 this->ValidateLinkGraph();
195 vtkStringArray* columnArr =
196 vtkArrayDownCast<vtkStringArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("column"));
197 vtkIdType source = -1;
198 vtkIdType target = -1;
199 for (vtkIdType i = 0; i < this->LinkGraph->GetNumberOfVertices(); i++)
200 {
201 if (column1 == columnArr->GetValue(i))
202 {
203 source = i;
204 }
205 if (column2 == columnArr->GetValue(i))
206 {
207 target = i;
208 }
209 }
210 if (source < 0)
211 {
212 this->AddLinkVertex(column1);
213 source = this->LinkGraph->GetNumberOfVertices() - 1;
214 }
215 if (target < 0)
216 {
217 this->AddLinkVertex(column2);
218 target = this->LinkGraph->GetNumberOfVertices() - 1;
219 }
220 this->LinkGraph->AddEdge(source, target);
221 this->Modified();
222}
223
224//------------------------------------------------------------------------------
225void vtkTableToGraph::ClearLinkEdges()

Callers 5

TestNetworkViewsFunction · 0.45
TestKCoreLayoutFunction · 0.45
TestStreamGraphFunction · 0.45
TestTableToGraphFunction · 0.45
TestMergeGraphsFunction · 0.45

Calls 8

ValidateLinkGraphMethod · 0.95
AddLinkVertexMethod · 0.95
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetNumberOfVerticesMethod · 0.80
GetValueMethod · 0.45
AddEdgeMethod · 0.45
ModifiedMethod · 0.45

Tested by 5

TestNetworkViewsFunction · 0.36
TestKCoreLayoutFunction · 0.36
TestStreamGraphFunction · 0.36
TestTableToGraphFunction · 0.36
TestMergeGraphsFunction · 0.36