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

Method BFSExpandSelection

Infovis/Core/vtkExpandSelectedGraph.cxx:126–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void vtkExpandSelectedGraph::BFSExpandSelection(vtkIdTypeArray* indexArray, vtkGraph* graph)
127{
128 // For each vertex in the selection get its adjacent vertices
129 VTK_CREATE(vtkInEdgeIterator, inIt);
130 VTK_CREATE(vtkOutEdgeIterator, outIt);
131
132 vtkAbstractArray* domainArr = graph->GetVertexData()->GetAbstractArray("domain");
133 std::set<vtkIdType> indexSet;
134 for (int i = 0; i < indexArray->GetNumberOfTuples(); ++i)
135 {
136 // First insert myself
137 indexSet.insert(indexArray->GetValue(i));
138
139 // Now insert all adjacent vertices
140 graph->GetInEdges(indexArray->GetValue(i), inIt);
141 while (inIt->HasNext())
142 {
143 vtkInEdgeType e = inIt->Next();
144 if (this->UseDomain && this->Domain &&
145 domainArr->GetVariantValue(e.Source).ToString() != this->Domain)
146 {
147 continue;
148 }
149 indexSet.insert(e.Source);
150 }
151 graph->GetOutEdges(indexArray->GetValue(i), outIt);
152 while (outIt->HasNext())
153 {
154 vtkOutEdgeType e = outIt->Next();
155 if (this->UseDomain && this->Domain && domainArr &&
156 domainArr->GetVariantValue(e.Target).ToString() != this->Domain)
157 {
158 continue;
159 }
160 indexSet.insert(e.Target);
161 }
162 }
163
164 // Delete any entries in the current selection list
165 indexArray->Reset();
166
167 // Convert the stl set into the selection list
168 std::set<vtkIdType>::iterator I;
169 for (I = indexSet.begin(); I != indexSet.end(); ++I)
170 {
171 indexArray->InsertNextValue(*I);
172 }
173}
174
175void vtkExpandSelectedGraph::PrintSelf(ostream& os, vtkIndent indent)
176{

Callers 1

ExpandMethod · 0.95

Calls 15

GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetOutEdgesMethod · 0.80
GetNumberOfTuplesMethod · 0.45
insertMethod · 0.45
GetValueMethod · 0.45
GetInEdgesMethod · 0.45
HasNextMethod · 0.45
NextMethod · 0.45
ToStringMethod · 0.45
GetVariantValueMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected