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

Function TestGraphAlgorithms

Infovis/Core/Testing/Cxx/TestGraphAlgorithms.cxx:63–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63int TestGraphAlgorithms(int argc, char* argv[])
64{
65 // Create the test graph
66 VTK_CREATE(vtkMutableUndirectedGraph, g);
67
68 VTK_CREATE(vtkPoints, pts);
69 g->AddVertex();
70 pts->InsertNextPoint(0, 1, 0);
71 g->AddVertex();
72 pts->InsertNextPoint(0.5, 1, 0);
73 g->AddVertex();
74 pts->InsertNextPoint(0.25, 0.5, 0);
75 g->AddVertex();
76 pts->InsertNextPoint(0, 0, 0);
77 g->AddVertex();
78 pts->InsertNextPoint(0.5, 0, 0);
79 g->AddVertex();
80 pts->InsertNextPoint(1, 0, 0);
81 g->AddVertex();
82 pts->InsertNextPoint(0.75, 0.5, 0);
83 g->SetPoints(pts);
84
85 g->AddEdge(0, 1);
86 g->AddEdge(0, 2);
87 g->AddEdge(1, 2);
88 g->AddEdge(2, 3);
89 g->AddEdge(2, 4);
90 g->AddEdge(3, 4);
91
92 VTK_CREATE(vtkRenderer, ren);
93
94 // Test vertex degree
95 VTK_CREATE(vtkVertexDegree, degree);
96 degree->SetInputData(g);
97 PerformAlgorithm(ren, degree, 0, 0, "VertexDegree", 0, 4);
98
99 VTK_CREATE(vtkRenderWindowInteractor, iren);
100 VTK_CREATE(vtkRenderWindow, win);
101 win->AddRenderer(ren);
102 win->SetInteractor(iren);
103
104 int retVal = vtkRegressionTestImage(win);
105 if (retVal == vtkRegressionTester::DO_INTERACTOR)
106 {
107 win->Render();
108 iren->Start();
109 retVal = vtkRegressionTester::PASSED;
110 }
111
112 return !retVal;
113}

Callers

nothing calls this directly

Calls 11

PerformAlgorithmFunction · 0.85
vtkRegressionTestImageFunction · 0.85
RenderMethod · 0.65
AddVertexMethod · 0.45
InsertNextPointMethod · 0.45
SetPointsMethod · 0.45
AddEdgeMethod · 0.45
SetInputDataMethod · 0.45
AddRendererMethod · 0.45
SetInteractorMethod · 0.45
StartMethod · 0.45

Tested by

no test coverage detected