Tulip 5.7.1
Large graphs analysis and drawing
Loading...
Searching...
No Matches
NumericProperty.h
1/*
2 *
3 * This file is part of Tulip (https://tulip.labri.fr)
4 *
5 * Authors: David Auber and the Tulip development Team
6 * from LaBRI, University of Bordeaux
7 *
8 * Tulip is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation, either version 3
11 * of the License, or (at your option) any later version.
12 *
13 * Tulip is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 */
19
20#ifndef NUMERICPROPERTY_H
21#define NUMERICPROPERTY_H
22
23#include <tulip/PropertyInterface.h>
24
25namespace tlp {
26
27/**
28 * @brief Interface all numerical properties.
29 * Property values are always returned as double
30 **/
31class TLP_SCOPE NumericProperty : public PropertyInterface {
32public:
33 /**
34 * @brief Returns the value associated with the node n in this property.
35 * @param n The node for which we want to get the value of the property.
36 **/
37 virtual double getNodeDoubleValue(const node n) const = 0;
38
39 /**
40 * @brief Gets the default node value of the property.
41 * @return The default value of nodes.
42 */
43 virtual double getNodeDoubleDefaultValue() const = 0;
44
45 /**
46 * @brief Gets the minimum value on the nodes.
47 * @param graph The graph on which to compute.
48 * @return The minimal value on this graph for this property.
49 **/
50 virtual double getNodeDoubleMin(const Graph *graph = nullptr) = 0;
51
52 /**
53 * @brief Gets the maximum value on the nodes.
54 * @param graph The graph on which to compute.
55 * @return The maximal value on this graph for this property.
56 **/
57 virtual double getNodeDoubleMax(const Graph *graph = nullptr) = 0;
58
59 /**
60 * @brief Returns the value associated with the edge e in this property.
61 * @param e The edge for which we want to get the value of the property.
62 **/
63 virtual double getEdgeDoubleValue(const edge e) const = 0;
64
65 /**
66 * @brief Gets the default edge value of the property.
67 * @return The default value of edges.
68 */
69 virtual double getEdgeDoubleDefaultValue() const = 0;
70
71 /**
72 * @brief Gets the minimum value on the edges.
73 * @param graph The graph on which to compute.
74 * @return The minimal value on this graph for this property.
75 **/
76 virtual double getEdgeDoubleMin(const Graph *graph = nullptr) = 0;
77
78 /**
79 * @brief Gets the maximum value on the edges.
80 * @param graph The graph on which to compute.
81 * @return The maximal value on this graph for this property.
82 **/
83 virtual double getEdgeDoubleMax(const Graph *graph = nullptr) = 0;
84
85 /**
86 * @brief computes a uniform quantification for the nodes
87 * associated values
88 */
89 virtual void nodesUniformQuantification(unsigned int) = 0;
90
91 /**
92 * @brief computes a uniform quantification for the edges
93 * associated values
94 */
95 virtual void edgesUniformQuantification(unsigned int) = 0;
96
97 /**
98 * @brief computes a uniform quantification for the nodes/edges
99 * associated values
100 */
101 void uniformQuantification(unsigned int k) {
102 nodesUniformQuantification(k);
103 edgesUniformQuantification(k);
104 }
105
106 /**
107 * @brief Creates a property of the same type (e.g. tlp::DoubleProperty)
108 * The new property will be a copy of this property's values for all
109 * the elements of the graph.
110 * @param graph The Graph in which to create the new property.
111 * @return The newly created property.
112 */
113 virtual NumericProperty *copyProperty(Graph *graph) = 0;
114
115 /**
116 * @brief Gets an iterator sorting nodes according to their values in that numeric property.
117 * @since Tulip 4.8
118 * @param sg If provided, returns an iterator on the subset of nodes defined by that subgraph.
119 * @return An iterator over graph nodes.
120 **/
121 virtual Iterator<node> *getSortedNodes(const Graph *sg = nullptr, bool ascendingOrder = true);
122
123 /**
124 * @brief Gets an iterator sorting edges according to their values in that numeric property.
125 * @since Tulip 4.8
126 * @param sg If provided, returns an iterator on the subset of edges defined by that subgraph.
127 * @param ascendingOrder defines the sort ordering (ascending or descending).
128 * @return An iterator over graph edges.
129 **/
130 virtual Iterator<edge> *getSortedEdges(const Graph *sg = nullptr, bool ascendingOrder = true);
131
132 /**
133 * @brief Gets an iterator sorting edges according to the values of their source nodes in that
134 *numeric property.
135 * @since Tulip 4.8
136 * @param sg If provided, returns an iterator on the subset of edges defined by that subgraph.
137 * @param ascendingOrder defines the sort ordering (ascending or descending).
138 * @return An iterator over graph edges.
139 **/
141 bool ascendingOrder = true);
142
143 /**
144 * @brief Gets an iterator sorting edges according to the values of their target nodes in that
145 *numeric property.
146 * @since Tulip 4.8
147 * @param sg If provided, returns an iterator on the subset of edges defined by that subgraph.
148 * @param ascendingOrder defines the sort ordering (ascending or descending).
149 * @return An iterator over graph edges.
150 **/
152 bool ascendingOrder = true);
153
154 /**
155 * @brief Gets an iterator sorting edges according to the values of their extremities in that
156 *numeric property.
157 * Vectors of two numbers (first element being the source node value, second one the target node
158 *value) are compared in that case.
159 * @since Tulip 4.8
160 * @param sg If provided, returns an iterator on the subset of edges defined by that subgraph.
161 * @param ascendingOrder defines the sort ordering (ascending or descending).
162 * @return An iterator over graph edges.
163 **/
165 bool ascendingOrder = true);
166};
167} // namespace tlp
168
169#endif // NUMERICPROPERTY_H
Interface all numerical properties. Property values are always returned as double.
virtual Iterator< edge > * getSortedEdges(const Graph *sg=nullptr, bool ascendingOrder=true)
Gets an iterator sorting edges according to their values in that numeric property.
virtual void edgesUniformQuantification(unsigned int)=0
computes a uniform quantification for the edges associated values
virtual double getEdgeDoubleValue(const edge e) const =0
Returns the value associated with the edge e in this property.
virtual Iterator< edge > * getSortedEdgesByTargetValue(const Graph *sg=nullptr, bool ascendingOrder=true)
Gets an iterator sorting edges according to the values of their target nodes in that numeric property...
virtual NumericProperty * copyProperty(Graph *graph)=0
Creates a property of the same type (e.g. tlp::DoubleProperty) The new property will be a copy of thi...
virtual double getEdgeDoubleMin(const Graph *graph=nullptr)=0
Gets the minimum value on the edges.
virtual double getEdgeDoubleMax(const Graph *graph=nullptr)=0
Gets the maximum value on the edges.
virtual double getEdgeDoubleDefaultValue() const =0
Gets the default edge value of the property.
virtual double getNodeDoubleDefaultValue() const =0
Gets the default node value of the property.
virtual double getNodeDoubleValue(const node n) const =0
Returns the value associated with the node n in this property.
virtual Iterator< edge > * getSortedEdgesBySourceValue(const Graph *sg=nullptr, bool ascendingOrder=true)
Gets an iterator sorting edges according to the values of their source nodes in that numeric property...
void uniformQuantification(unsigned int k)
computes a uniform quantification for the nodes/edges associated values
virtual double getNodeDoubleMax(const Graph *graph=nullptr)=0
Gets the maximum value on the nodes.
virtual void nodesUniformQuantification(unsigned int)=0
computes a uniform quantification for the nodes associated values
virtual double getNodeDoubleMin(const Graph *graph=nullptr)=0
Gets the minimum value on the nodes.
virtual Iterator< node > * getSortedNodes(const Graph *sg=nullptr, bool ascendingOrder=true)
Gets an iterator sorting nodes according to their values in that numeric property.
virtual Iterator< edge > * getSortedEdgesByExtremitiesValues(const Graph *sg=nullptr, bool ascendingOrder=true)
Gets an iterator sorting edges according to the values of their extremities in that numeric property....
PropertyInterface describes the interface of a graph property.
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Iterator.h:74
The edge struct represents an edge in a Graph object.
Definition: Edge.h:40
The node struct represents a node in a Graph object.
Definition: Node.h:40