forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkCollapseGraph.h
75 lines (60 loc) · 2.67 KB
/
vtkCollapseGraph.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCollapseGraph.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkCollapseGraph - "Collapses" vertices onto their neighbors.
// .SECTION Description
//
// vtkCollapseGraph "collapses" vertices onto their neighbors, while maintaining
// connectivity. Two inputs are required - a graph (directed or undirected),
// and a vertex selection that can be converted to indices.
//
// Conceptually, each of the vertices specified in the input selection
// expands, "swallowing" adacent vertices. Edges to-or-from the "swallowed"
// vertices become edges to-or-from the expanding vertices, maintaining the
// overall graph connectivity.
//
// In the case of directed graphs, expanding vertices only swallow vertices that
// are connected via out edges. This rule provides intuitive behavior when
// working with trees, so that "child" vertices collapse into their parents
// when the parents are part of the input selection.
//
// Input port 0: graph
// Input port 1: selection
#ifndef vtkCollapseGraph_h
#define vtkCollapseGraph_h
#include "vtkInfovisCoreModule.h" // For export macro
#include "vtkGraphAlgorithm.h"
class VTKINFOVISCORE_EXPORT vtkCollapseGraph : public vtkGraphAlgorithm
{
public:
static vtkCollapseGraph* New();
vtkTypeMacro(vtkCollapseGraph,vtkGraphAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
/// Convenience function provided for setting the graph input.
void SetGraphConnection(vtkAlgorithmOutput*);
/// Convenience function provided for setting the selection input.
void SetSelectionConnection(vtkAlgorithmOutput*);
protected:
vtkCollapseGraph();
~vtkCollapseGraph();
int FillInputPortInformation(int port, vtkInformation* info);
int RequestData(
vtkInformation*,
vtkInformationVector**,
vtkInformationVector*);
private:
vtkCollapseGraph(const vtkCollapseGraph&); // Not implemented
void operator=(const vtkCollapseGraph&); // Not implemented
};
#endif