File: vtkKCoreLayout.h

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-8.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 118,972 kB
  • sloc: cpp: 1,442,790; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 68; objc: 17
file content (156 lines) | stat: -rw-r--r-- 5,554 bytes parent folder | download | duplicates (5)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkKCoreLayout.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 vtkKCoreLayout - Produces a layout for a graph labeled with K-Core
//                        information.
// .SECTION Description
//
// vtkKCoreLayout creates coordinates for each vertex that can be used to
// perform a layout for a k-core view.
// Prerequisite:  Vertices must have an attribute array containing their
//                k-core number.  This layout is based on the algorithm
//                described in the paper: "k-core decomposition: a tool
//                for the visualization of large scale networks", by
//                Ignacio Alvarez-Hamelin et. al.
//
//                This graph algorithm appends either polar coordinates or cartesian coordinates
//                as vertex attributes to the graph giving the position of the vertex in a layout.
//                Input graphs must have the k-core number assigned to each vertex (default
//                attribute array storing kcore numbers is "kcore").
//
//                Epsilon - this factor is used to adjust the amount vertices are 'pulled' out of
//                          their default ring radius based on the number of neighbors in higher
//                          cores.  Default=0.2
//                UnitRadius - Tweaks the base unit radius value.  Default=1.0
//
//                Still TODO: Still need to work on the connected-components within each shell and
//                            associated layout issues with that.
//
// Input port 0: graph
//
// .SECTION Thanks
// Thanks to William McLendon from Sandia National Laboratories for providing this
// implementation.


#ifndef vtkKCoreLayout_h
#define vtkKCoreLayout_h

#include "vtkInfovisLayoutModule.h" // For export macro
#include "vtkGraphAlgorithm.h"

class VTKINFOVISLAYOUT_EXPORT vtkKCoreLayout : public vtkGraphAlgorithm
{
public:
  static vtkKCoreLayout* New();
  vtkTypeMacro(vtkKCoreLayout,vtkGraphAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  /// Convenience function provided for setting the graph input.
  void SetGraphConnection(vtkAlgorithmOutput*);

  vtkKCoreLayout();
  ~vtkKCoreLayout();

  int FillInputPortInformation(int port, vtkInformation* info);

  // Description:
  // Set the name of the vertex attribute array storing k-core labels.
  // Default: kcore
  vtkSetStringMacro(KCoreLabelArrayName);

  // Description:
  // Output polar coordinates for vertices if True.  Default column names are
  // coord_radius, coord_angle.
  // Default: False
  vtkGetMacro( Polar, bool );
  vtkSetMacro( Polar, bool );
  vtkBooleanMacro( Polar, bool );

  // Description:
  // Set whether or not to convert output to cartesian coordinates.  If false, coordinates
  // will be returned in polar coordinates (radius, angle).
  // Default: True
  vtkGetMacro( Cartesian, bool );
  vtkSetMacro( Cartesian, bool );
  vtkBooleanMacro( Cartesian, bool );

  // Description:
  // Polar coordinates array name for radius values.
  // This is only used if OutputCartesianCoordinates is False.
  // Default: coord_radius
  vtkSetStringMacro(PolarCoordsRadiusArrayName);
  vtkGetStringMacro(PolarCoordsRadiusArrayName);

  // Description:
  // Polar coordinates array name for angle values in radians.
  // This is only used if OutputCartesianCoordinates is False.
  // Default: coord_angle
  vtkSetStringMacro(PolarCoordsAngleArrayName);
  vtkGetStringMacro(PolarCoordsAngleArrayName);

  // Description:
  // Cartesian coordinates array name for the X coordinates.
  // This is only used if OutputCartesianCoordinates is True.
  // Default: coord_x
  vtkSetStringMacro(CartesianCoordsXArrayName);
  vtkGetStringMacro(CartesianCoordsXArrayName);

  // Description:
  // Cartesian coordinates array name for the Y coordinates.
  // This is only used if OutputCartesianCoordinates is True.
  // Default: coord_y
  vtkSetStringMacro(CartesianCoordsYArrayName);
  vtkGetStringMacro(CartesianCoordsYArrayName);

  // Description:
  // Epsilon value used in the algorithm.
  // Default = 0.2
  vtkSetMacro( Epsilon, float );
  vtkGetMacro( Epsilon, float );

  // Description:
  // Unit Radius value used in the algorithm.
  // Default = 1.0
  vtkSetMacro( UnitRadius, float );
  vtkGetMacro( UnitRadius, float );


  int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);

protected:
  char * KCoreLabelArrayName;

  char * PolarCoordsRadiusArrayName;
  char * PolarCoordsAngleArrayName;

  char * CartesianCoordsXArrayName;
  char * CartesianCoordsYArrayName;

  bool Cartesian;
  bool Polar;

  float Epsilon;
  float UnitRadius;

private:
  vtkKCoreLayout(const vtkKCoreLayout&);   // Not implemented
  void operator=(const vtkKCoreLayout&);   // Not implemented
};

#endif