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

Function TestToDirectedGraph

Common/DataModel/Testing/Cxx/TestGraph2.cxx:70–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int TestToDirectedGraph()
71{
72 // Create an undirected graph
73 vtkSmartPointer<vtkMutableUndirectedGraph> ug = vtkSmartPointer<vtkMutableUndirectedGraph>::New();
74 vtkIdType v0 = ug->AddVertex();
75 vtkIdType v1 = ug->AddVertex();
76 vtkIdType v2 = ug->AddVertex();
77
78 ug->AddEdge(v0, v1);
79 ug->AddEdge(v1, v2);
80
81 // Convert it to a directed graph
82 vtkSmartPointer<vtkMutableDirectedGraph> dg = vtkSmartPointer<vtkMutableDirectedGraph>::New();
83 ug->ToDirectedGraph(dg);
84
85 // Check that the number of vertices and edges is unchanged
86 if (ug->GetNumberOfVertices() != dg->GetNumberOfVertices() ||
87 ug->GetNumberOfEdges() != dg->GetNumberOfEdges())
88 {
89 return EXIT_FAILURE;
90 }
91
92 return EXIT_SUCCESS;
93}
94
95int TestToUndirectedGraph()
96{

Callers 1

TestGraph2Function · 0.85

Calls 6

ToDirectedGraphMethod · 0.80
GetNumberOfVerticesMethod · 0.80
NewFunction · 0.50
AddVertexMethod · 0.45
AddEdgeMethod · 0.45
GetNumberOfEdgesMethod · 0.45

Tested by

no test coverage detected