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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
/**
*
* This file is part of Tulip (www.tulip-software.org)
*
* Authors: David Auber and the Tulip development Team
* from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
*
* Tulip is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
*
* Tulip is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*/
// +-------------------------------------------------------------------------+
// | Tulip Python Bindings |
// | inspired from bindings by the Booggie project development team |
// | (http://booggie.org/) |
// +-------------------------------------------------------------------------+
namespace tlp {
class NumericProperty : tlp::PropertyInterface /Abstract/ {
%TypeHeaderCode
#include <tulip/NumericProperty.h>
%End
%ConvertToSubClassCode
if (dynamic_cast<tlp::DoubleProperty *>(sipCpp)) {
sipType = sipFindType("tlp::DoubleProperty");
} else if (dynamic_cast<tlp::IntegerProperty *>(sipCpp)) {
sipType = sipFindType("tlp::IntegerProperty");
} else {
sipType = NULL;
}
%End
%Docstring
Bases: :class:`tlp.PropertyInterface`
%End
public:
//===========================================================================================
double getNodeDoubleDefaultValue();
%Docstring
tlp.NumericProperty.getNodeDoubleDefaultValue()
Returns the default value associated to the nodes.
:rtype: float
%End
//===========================================================================================
double getEdgeDoubleDefaultValue();
%Docstring
tlp.NumericProperty.getEdgeDoubleDefaultValue()
Returns the default value associated to the edges.
:rtype: float
%End
//===========================================================================================
const double getNodeDoubleValue(const tlp::node node);
%Docstring
tlp.NumericProperty.getNodeDoubleValue(node)
Returns the value associated to a particular node.
:param node: an existing node
:type node: :class:`tlp.node`
:rtype: float
:throws: an exception if the node does not belong to the graph attached to the property
%End
%MethodCode
if (sipCpp->getGraph()->isElement(*a0)) {
sipRes = sipCpp->getNodeDoubleValue(*a0);
} else {
sipIsErr = throwInvalidNodeException(sipCpp->getGraph(), *a0);
}
%End
//===========================================================================================
const double getEdgeDoubleValue(const tlp::edge edge);
%Docstring
tlp.NumericProperty.getEdgeDoubleValue(edge)
Returns the value associated to a particular edge.
:param edge: an existing edge
:type edge: :class:`tlp.edge`
:rtype: float
:throws: an exception if the edge does not belong to the graph attached to the property
%End
%MethodCode
if (sipCpp->getGraph()->isElement(*a0)) {
sipRes = sipCpp->getEdgeDoubleValue(*a0);
} else {
sipIsErr = throwInvalidEdgeException(sipCpp->getGraph(), *a0);
}
%End
//===========================================================================================
double getNodeDoubleMin(tlp::Graph *subgraph=0);
%Docstring
tlp.NumericProperty.getNodeDoubleMin([subgraph = None])
Returns the minimum value on the nodes for that property.
:param subgraph: a sub-graph can be given in parameter, in that case return the minimum value on the nodes belonging to that sub-graph.
:type subgraph: :class:`tlp.Graph`
:rtype: float
%End
//===========================================================================================
double getNodeDoubleMax(tlp::Graph *subgraph=0);
%Docstring
tlp.NumericProperty.getNodeDoubleMax([subgraph = None])
Returns the maximum value on the nodes for that property.
:param subgraph: a sub-graph can be given in parameter, in that case return the maximum value on the nodes belonging to that sub-graph.
:type subgraph: :class:`tlp.Graph`
:rtype: float
%End
//===========================================================================================
double getEdgeDoubleMin(tlp::Graph *subgraph=0);
%Docstring
tlp.NumericProperty.getEdgeDoubleMin([subgraph = None])
Returns the minimum value on the edges for that property.
:param subgraph: a sub-graph can be given in parameter, in that case return the minimum value on the edges belonging to that sub-graph.
:type subgraph: :class:`tlp.Graph`
:rtype: float
%End
//===========================================================================================
double getEdgeDoubleMax(tlp::Graph *subgraph=0);
%Docstring
tlp.NumericProperty.getEdgeDoubleMax([subgraph = None])
Returns the maximum value on the edges for that double property.
:param subgraph: a sub-graph can be given in parameter, in that case return the maximum value on the edges belonging to that sub-graph.
:type subgraph: :class:`tlp.Graph`
:rtype: float
%End
//===========================================================================================
void uniformQuantification(unsigned int n);
%Docstring
tlp.NumericProperty.uniformQuantification(n)
Performs an uniform quantification on nodes and edges based on the values stored in that property.
An uniform quantification tries to separate the nodes and edges in n classes of equivalent size according to theirs values in increasing order.
:param n: the number of desired classes
:type n: integer
.. warning:: All previous values on nodes and edges will be erased and replaced by the id of the class they belong to.
%End
//===========================================================================================
void nodesUniformQuantification(unsigned int n);
%Docstring
tlp.NumericProperty.nodesUniformQuantification(n)
Performs an uniform quantification on nodes based on the values stored in that property.
An uniform quantification tries to separate the nodes in n classes of equivalent size according to theirs values in increasing order.
:param n: the number of desired classes
:type n: integer
.. warning:: All previous values on nodes will be erased and replaced by the id of the class they belong to.
%End
//===========================================================================================
void edgesUniformQuantification(unsigned int n);
%Docstring
tlp.NumericProperty.edgesUniformQuantification(n)
Performs an uniform quantification on edges based on the values stored in that double property.
An uniform quantification tries to separate the edges in n classes of equivalent size according to theirs values in increasing order.
:param n: the number of desired classes
:type n: integer
.. warning:: All previous values on edges will be erased and replaced by the id of the class they belong to.
%End
//===========================================================================================
tlp::Iterator<tlp::node>* getSortedNodes(tlp::Graph *sg = NULL, bool ascendingOrder = true);
%Docstring
tlp.NumericProperty.getSortedNodes([subgraph=None, ascendingOrder=True])
.. versionadded:: 4.8
Gets an iterator sorting nodes according to their values in that numeric property.
:param subgraph: If provided, returns an iterator on the subset of nodes defined by that subgraph
:type subgraph: :class:`tlp.Graph`
:param ascendingOrder: defines the sort ordering (ascending or descending)
:type ascendingOrder: boolean
:rtype: a Tulip iterator on :class:`tlp.node` objects
%End
//===========================================================================================
tlp::Iterator<tlp::edge>* getSortedEdges(tlp::Graph *sg = NULL, bool ascendingOrder = true);
%Docstring
tlp.NumericProperty.getSortedEdges([subgraph=None, ascendingOrder=True])
.. versionadded:: 4.8
Gets an iterator sorting edges according to their values in that numeric property.
:param subgraph: If provided, returns an iterator on the subset of edges defined by that subgraph
:type subgraph: :class:`tlp.Graph`
:param ascendingOrder: defines the sort ordering (ascending or descending)
:type ascendingOrder: boolean
:rtype: a Tulip iterator on :class:`tlp.edge` objects
%End
//===========================================================================================
tlp::Iterator<tlp::edge>* getSortedEdgesBySourceValue(tlp::Graph *sg = NULL, bool ascendingOrder = true);
%Docstring
tlp.NumericProperty.getSortedEdgesBySourceValue([subgraph=None, ascendingOrder=True])
.. versionadded:: 4.8
Gets an iterator sorting edges according to the values of their source nodes in that numeric property.
:param subgraph: If provided, returns an iterator on the subset of edges defined by that subgraph
:type subgraph: :class:`tlp.Graph`
:param ascendingOrder: defines the sort ordering (ascending or descending)
:type ascendingOrder: boolean
:rtype: a Tulip iterator on :class:`tlp.edge` objects
%End
//===========================================================================================
tlp::Iterator<tlp::edge>* getSortedEdgesByTargetValue(tlp::Graph *sg = NULL, bool ascendingOrder = true);
%Docstring
tlp.NumericProperty.getSortedEdgesByTargetValue([subgraph=None, ascendingOrder=True])
.. versionadded:: 4.8
Gets an iterator sorting edges according to the values of their target nodes in that numeric property.
:param subgraph: If provided, returns an iterator on the subset of edges defined by that subgraph
:type subgraph: :class:`tlp.Graph`
:param ascendingOrder: defines the sort ordering (ascending or descending)
:type ascendingOrder: boolean
:rtype: a Tulip iterator on :class:`tlp.edge` objects
%End
//===========================================================================================
tlp::Iterator<tlp::edge>* getSortedEdgesByExtremitiesValues(tlp::Graph *sg = NULL, bool ascendingOrder = true);
%Docstring
tlp.NumericProperty.getSortedEdgesByExtremitiesValues([subgraph=None, ascendingOrder=True])
.. versionadded:: 4.8
Gets an iterator sorting edges according to the values of their extremities in that numeric property.
Vectors of two numbers (first element being the source node value, second one the target node value) are compared in that case.
:param subgraph: If provided, returns an iterator on the subset of edges defined by that subgraph
:type subgraph: :class:`tlp.Graph`
:param ascendingOrder: defines the sort ordering (ascending or descending)
:type ascendingOrder: boolean
:rtype: a Tulip iterator on :class:`tlp.edge` objects
%End
};
};
|