Tulip  5.4.0
Large graphs analysis and drawing
AbstractProperty.h
1 /*
2  *
3  * This file is part of Tulip (http://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 ABSTRACT_PROPERTY_H
21 #define ABSTRACT_PROPERTY_H
22 
23 #include <typeinfo>
24 #include <string>
25 #include <cstdlib>
26 #include <tulip/tulipconf.h>
27 #include <tulip/StoredType.h>
28 #include <tulip/MutableContainer.h>
29 #include <tulip/PropertyInterface.h>
30 #include <tulip/Iterator.h>
31 #include <tulip/DataSet.h>
32 #include <tulip/Graph.h>
33 
34 namespace tlp {
35 
36 class GraphView;
37 
38 //==============================================================
39 
40 /**
41  * @ingroup Graph
42  * @brief This class extends upon PropertyInterface, and adds type-safe methods to
43  * get and set the node and edge values, through the magic of template programming.
44  *
45  * Nodes and Edges can have different types (e.g. tlp::LayoutProperty has tlp::PointType as node
46  * type and tlp::LineType as edge type),
47  * but most of the time they have the same type (e.g. tlp::DoubleProperty, tlp::IntegerProperty).
48  *
49  * Some of the pure virtual functions of PropertyInterface are implemented in this class (e.g.
50  * erase()).
51  *
52  * The actual data is stored in this class, and it manages the default values.
53  */
54 template <class Tnode, class Tedge, class Tprop = PropertyInterface>
55 class TLP_SCOPE AbstractProperty : public Tprop {
56  friend class Graph;
57  friend class GraphView;
58 
59 public:
60  AbstractProperty(Graph *, const std::string &n = "");
61 
62  /**
63  * @brief Gets the default node value of the property.
64  * @return The default value of nodes.
65  */
66  typename Tnode::RealType getNodeDefaultValue() const;
67 
68  /**
69  * @brief Gets the default edge value of the property.
70  * @return The default value of edges.
71  **/
72  typename Tedge::RealType getEdgeDefaultValue() const;
73 
74  /**
75  * @brief Returns the value associated with the node n in this property.
76  * If there is no value, it returns the default node value.
77  *
78  * @param n The node for which we want to get the value of the property.
79  * @return :StoredType< Tnode::RealType >::ReturnedConstValue The value of the property for this
80  *node.
81  **/
82  typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue
83  getNodeValue(const node n) const;
84 
85  /**
86  * @brief Returns the value associated to the edge e in this property.
87  * If there is no value, it returns the default edge value.
88  *
89  * @param e The edge for which we want to get the value of the property.
90  * @return :StoredType< Tedge::RealType >::ReturnedConstValue The value of the property for this
91  *edge.
92  **/
93  typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue
94  getEdgeValue(const edge e) const;
95 
96  /**
97  * Returns an iterator through all nodes belonging to g
98  * whose associated value is equal to val.
99  * If g is nullptr, the graph given when creating the property is considered.
100  */
101  virtual tlp::Iterator<node> *
102  getNodesEqualTo(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v,
103  const Graph *g = nullptr) const;
104 
105  /**
106  * Returns an iterator through all edges belonging to g
107  * whose associated value is equal to val.
108  * If g is nullptr, the graph given when creating the property is considered.
109  */
110  virtual tlp::Iterator<edge> *
111  getEdgesEqualTo(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v,
112  const Graph *g = nullptr) const;
113 
114  /**
115  * @brief Sets the value of a node and notify the observers of a modification.
116  *
117  * @param n The node to set the value of.
118  * @param v The value to affect for this node.
119  **/
120  virtual void
121  setNodeValue(const node n,
122  typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
123 
124  /**
125  * @brief Set the value of an edge and notify the observers of a modification.
126  *
127  * @param e The edge to set the value of.
128  * @param v The value to affect for this edge.
129  **/
130  virtual void
131  setEdgeValue(const edge e,
132  typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
133 
134  /**
135  * @brief Sets the value of all nodes and notify the observers.
136  * All previous values are lost and the given value is assigned as the default one to the future
137  *added nodes.
138  *
139  * @param v The value to set to all nodes.
140  *
141  **/
142  virtual void
143  setAllNodeValue(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
144 
145  /**
146  * @brief Sets the value assigned as the default one to the future added nodes.
147  *
148  * @since Tulip 5.0
149  *
150  * @param v the new value to set on future added nodes.
151  *
152  * @return Whether the given string was a correct representation for this property's type. If not,
153  * the default value is not set.
154  */
155  virtual void
156  setNodeDefaultValue(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
157 
158  /**
159  * @brief Sets the value of all nodes in a graph and notify the observers.
160  * Only the nodes from that graph will have their value modified in the property
161  * and the default node value will not be modified.
162  *
163  * @since Tulip 5.0
164  *
165  * @param v The value to set to all nodes.
166  * @param graph A graph that defines the set of nodes
167  *
168  *
169  * @warning If the provided graph is not a descendant of the one associated to that property
170  *(including itself),
171  * no node value will be modified.
172  *
173  **/
174  virtual void
175  setValueToGraphNodes(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v,
176  const Graph *graph);
177 
178  /**
179  * @brief Sets the value assigned as the default one to the future added edges.
180  *
181  * @since Tulip 5.0
182  *
183  * @param value the new value to set on future added edges.
184  *
185  * @return Whether the given string was a correct representation for this property's type. If not,
186  * the default value is not set.
187  */
188  virtual void
189  setEdgeDefaultValue(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
190 
191  /**
192  * @brief Sets the value of all edges and notify the observers.
193  * All previous values are lost and the given value is assigned as the default one to the future
194  *added edges.
195  *
196  * @param v The value to set to all edges.
197  *
198  **/
199  virtual void
200  setAllEdgeValue(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
201 
202  /**
203  * @brief Sets the value of all edges in a graph and notify the observers.
204  * Only the edges from that graph will have their value modified in the property
205  * and the default edge value will not be modified.
206  *
207  * @since Tulip 5.0
208  *
209  * @param v The value to set to all edges.
210  * @param graph A graph on which to modify
211  *
212  *
213  * @warning If the provided graph is not a descendant of the one associated to that property
214  *(including itself),
215  * no edge value will be modified.
216  *
217  **/
218  virtual void
219  setValueToGraphEdges(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v,
220  const Graph *graph);
221  //=================================================================================
222 
223  /**
224  * @brief Resets the value of a node to the default value.
225  *
226  * @param n The node to reset the value of.
227  *
228  **/
229  inline void erase(const node n) override {
230  setNodeValue(n, nodeDefaultValue);
231  }
232  //=================================================================================
233 
234  /**
235  * @brief Resets the value of an edge to the default value.
236  *
237  * @param e The edge to reset the value of.
238  *
239  **/
240  inline void erase(const edge e) override {
241  setEdgeValue(e, edgeDefaultValue);
242  }
243  //=================================================================================
244  /**
245  * @brief This operator overload allows to copy a property using the following syntax :
246  *
247  * @code
248  * IntegerProperty* shape = graph->getProperty<IntegerProperty>("viewShape");
249  * IntegerProperty* backup = graph->getProperty<IntegerProperty>("shapeBackup");
250  * *backup = *shape; // all the values from 'shape' will be copied into 'backup'.
251  * @endcode
252  * @param prop The property to copy the values from.
253  * @return This property with the values copied.
254  */
257  if (this != &prop) {
258  if (Tprop::graph == nullptr)
259  Tprop::graph = prop.Tprop::graph;
260 
261  if (Tprop::graph == prop.Tprop::graph) {
262  setAllNodeValue(prop.getNodeDefaultValue());
263  setAllEdgeValue(prop.getEdgeDefaultValue());
264 
265  for (auto itn : prop.getNonDefaultValuatedNodes()) {
266  setNodeValue(itn, prop.getNodeValue(itn));
267  }
268 
269  for (auto ite : prop.getNonDefaultValuatedEdges()) {
270  setEdgeValue(ite, prop.getEdgeValue(ite));
271  }
272 
273  } else {
274  //==============================================================*
275  for (auto n : Tprop::graph->nodes()) {
276  if (prop.Tprop::graph->isElement(n))
277  setNodeValue(n, prop.getNodeValue(n));
278  }
279 
280  for (auto e : Tprop::graph->edges()) {
281  if (prop.Tprop::graph->isElement(e))
282  setEdgeValue(e, prop.getEdgeValue(e));
283  }
284  }
285 
286  clone_handler(prop);
287  }
288 
289  return *this;
290  }
291  //=================================================================================
292  // Untyped accessors inherited from PropertyInterface, documentation is inherited
293  std::string getNodeDefaultStringValue() const override {
294  typename Tnode::RealType v = getNodeDefaultValue();
295  return Tnode::toString(v);
296  }
297  std::string getEdgeDefaultStringValue() const override {
298  typename Tedge::RealType v = getEdgeDefaultValue();
299  return Tedge::toString(v);
300  }
301  std::string getNodeStringValue(const node n) const override {
302  typename Tnode::RealType v = getNodeValue(n);
303  return Tnode::toString(v);
304  }
305  std::string getEdgeStringValue(const edge e) const override {
306  typename Tedge::RealType v = getEdgeValue(e);
307  return Tedge::toString(v);
308  }
309  bool setNodeStringValue(const node inN, const std::string &inV) override {
310  typename Tnode::RealType v;
311 
312  if (!Tnode::fromString(v, inV))
313  return false;
314 
315  setNodeValue(inN, v);
316  return true;
317  }
318  bool setEdgeStringValue(const edge inE, const std::string &inV) override {
319  typename Tedge::RealType v;
320 
321  if (!Tedge::fromString(v, inV))
322  return false;
323 
324  setEdgeValue(inE, v);
325  return true;
326  }
327  bool setNodeDefaultStringValue(const std::string &inV) override {
328  typename Tnode::RealType v;
329 
330  if (!Tnode::fromString(v, inV))
331  return false;
332 
333  setNodeDefaultValue(v);
334  return true;
335  }
336  bool setAllNodeStringValue(const std::string &inV) override {
337  typename Tnode::RealType v;
338 
339  if (!Tnode::fromString(v, inV))
340  return false;
341 
342  setAllNodeValue(v);
343  return true;
344  }
345  bool setStringValueToGraphNodes(const std::string &inV, const Graph *graph) override {
346  typename Tnode::RealType v;
347 
348  if (!Tnode::fromString(v, inV))
349  return false;
350 
351  setValueToGraphNodes(v, graph);
352  return true;
353  }
354  bool setEdgeDefaultStringValue(const std::string &inV) override {
355  typename Tedge::RealType v;
356 
357  if (!Tedge::fromString(v, inV))
358  return false;
359 
360  setEdgeDefaultValue(v);
361  return true;
362  }
363  bool setAllEdgeStringValue(const std::string &inV) override {
364  typename Tedge::RealType v;
365 
366  if (!Tedge::fromString(v, inV))
367  return false;
368 
369  setAllEdgeValue(v);
370  return true;
371  }
372  bool setStringValueToGraphEdges(const std::string &inV, const Graph *graph) override {
373  typename Tedge::RealType v;
374 
375  if (!Tedge::fromString(v, inV))
376  return false;
377 
378  setValueToGraphEdges(v, graph);
379  return true;
380  }
381  tlp::Iterator<node> *getNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
382  bool hasNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
383  unsigned int numberOfNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
384  unsigned int nodeValueSize() const override;
385  void writeNodeDefaultValue(std::ostream &) const override;
386  void writeNodeValue(std::ostream &, node) const override;
387  bool readNodeDefaultValue(std::istream &) override;
388  bool readNodeValue(std::istream &, node) override;
389  tlp::Iterator<edge> *getNonDefaultValuatedEdges(const Graph *g = nullptr) const override;
390  bool hasNonDefaultValuatedEdges(const Graph *g = nullptr) const override;
391  unsigned int numberOfNonDefaultValuatedEdges(const Graph * = nullptr) const override;
392  unsigned int edgeValueSize() const override;
393  void writeEdgeDefaultValue(std::ostream &) const override;
394  void writeEdgeValue(std::ostream &, edge) const override;
395  bool readEdgeDefaultValue(std::istream &) override;
396  bool readEdgeValue(std::istream &, edge) override;
397  bool copy(const node destination, const node source, PropertyInterface *property,
398  bool ifNotDefault = false) override {
399  if (property == nullptr)
400  return false;
401 
403  dynamic_cast<tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
404  assert(tp);
405  bool notDefault;
406  typename StoredType<typename Tnode::RealType>::ReturnedValue value =
407  tp->nodeProperties.get(source.id, notDefault);
408 
409  if (ifNotDefault && !notDefault)
410  return false;
411 
412  setNodeValue(destination, value);
413  return true;
414  }
415  bool copy(const edge destination, const edge source, PropertyInterface *property,
416  bool ifNotDefault = false) override {
417  if (property == nullptr)
418  return false;
419 
421  dynamic_cast<tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
422  assert(tp);
423  bool notDefault;
424  typename StoredType<typename Tedge::RealType>::ReturnedValue value =
425  tp->edgeProperties.get(source.id, notDefault);
426 
427  if (ifNotDefault && !notDefault)
428  return false;
429 
430  setEdgeValue(destination, value);
431  return true;
432  }
433  void copy(PropertyInterface *property) override {
435  dynamic_cast<typename tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
436  assert(prop != nullptr);
437  *this = *prop;
438  }
439  // for performance reason and use in GraphUpdatesRecorder
440  DataMem *getNodeDefaultDataMemValue() const override {
441  return new TypedValueContainer<typename Tnode::RealType>(getNodeDefaultValue());
442  }
443  DataMem *getEdgeDefaultDataMemValue() const override {
444  return new TypedValueContainer<typename Tedge::RealType>(getEdgeDefaultValue());
445  }
446  DataMem *getNodeDataMemValue(const node n) const override {
447  return new TypedValueContainer<typename Tnode::RealType>(getNodeValue(n));
448  }
449  DataMem *getEdgeDataMemValue(const edge e) const override {
450  return new TypedValueContainer<typename Tedge::RealType>(getEdgeValue(e));
451  }
452  DataMem *getNonDefaultDataMemValue(const node n) const override {
453  bool notDefault;
454  typename StoredType<typename Tnode::RealType>::ReturnedValue value =
455  nodeProperties.get(n.id, notDefault);
456 
457  if (notDefault)
458  return new TypedValueContainer<typename Tnode::RealType>(value);
459 
460  return nullptr;
461  }
462  DataMem *getNonDefaultDataMemValue(const edge e) const override {
463  bool notDefault;
464  typename StoredType<typename Tedge::RealType>::ReturnedValue value =
465  edgeProperties.get(e.id, notDefault);
466 
467  if (notDefault)
468  return new TypedValueContainer<typename Tedge::RealType>(value);
469 
470  return nullptr;
471  }
472  void setNodeDataMemValue(const node n, const DataMem *v) override {
473  setNodeValue(n, static_cast<const TypedValueContainer<typename Tnode::RealType> *>(v)->value);
474  }
475  void setEdgeDataMemValue(const edge e, const DataMem *v) override {
476  setEdgeValue(e, static_cast<const TypedValueContainer<typename Tedge::RealType> *>(v)->value);
477  }
478  void setAllNodeDataMemValue(const DataMem *v) override {
479  setAllNodeValue(static_cast<const TypedValueContainer<typename Tnode::RealType> *>(v)->value);
480  }
481  void setAllEdgeDataMemValue(const DataMem *v) override {
482  setAllEdgeValue(static_cast<const TypedValueContainer<typename Tedge::RealType> *>(v)->value);
483  }
484 
485  // PropertyInterface methods
486  // mN is the meta node, sg is the corresponding subgraph
487  // and mg is the graph owning mN
488  void computeMetaValue(node n, Graph *sg, Graph *mg) override {
489  if (Tprop::metaValueCalculator)
491  Tprop::metaValueCalculator)
492  ->computeMetaValue(this, n, sg, mg);
493  }
494  // mE is the meta edge, itE is an iterator on the underlying edges
495  // mg is the graph owning mE
496  void computeMetaValue(edge e, tlp::Iterator<edge> *itE, Graph *mg) override {
497  if (Tprop::metaValueCalculator)
499  Tprop::metaValueCalculator)
500  ->computeMetaValue(this, e, itE, mg);
501  }
502  void setMetaValueCalculator(PropertyInterface::MetaValueCalculator *mvCalc) override {
503  if (mvCalc &&
505  mvCalc)) {
506  tlp::warning()
507  << "Warning : " << __PRETTY_FUNCTION__ << " ... invalid conversion of "
508  << typeid(mvCalc).name() << "into "
510  .name()
511  << std::endl;
512  abort();
513  }
514 
515  Tprop::metaValueCalculator = mvCalc;
516  }
517 
518  int compare(const node n1, const node n2) const override;
519  int compare(const edge e1, const edge e2) const override;
520 
521  /**
522  * @brief This class is used to delegate the computation of the values associated to meta nodes or
523  *edges.
524  **/
526  public:
527  // computes the value of the meta node mN of the graph mg
528  // for the property prop, according to the values associated
529  // to the underlying nodes i.e the nodes of the subgraph sg.
530  virtual void computeMetaValue(AbstractProperty<Tnode, Tedge, Tprop> *, node, Graph *, Graph *) {
531  }
532  // computes the value of the meta node mE of the graph mg
533  // for the property prop, according to the values associated
534  // to the underlying edges given by the iterator itE.
535  // The method do not have to delete the iterator
536  virtual void computeMetaValue(AbstractProperty<Tnode, Tedge, Tprop> *, edge,
537  tlp::Iterator<edge> *, Graph *) {}
538  };
539 
540 protected:
541  //=================================================================================
542  /// Enable to clone part of sub_class
544 
545  MutableContainer<typename Tnode::RealType> nodeProperties;
546  MutableContainer<typename Tedge::RealType> edgeProperties;
547  typename Tnode::RealType nodeDefaultValue;
548  typename Tedge::RealType edgeDefaultValue;
549 };
550 
551 template <typename vectType, typename eltType, typename propType = VectorPropertyInterface>
552 class TLP_SCOPE AbstractVectorProperty : public AbstractProperty<vectType, vectType, propType> {
553 public:
554  AbstractVectorProperty(Graph *, const std::string &name = "");
555 
556  // 5 methods inherited from VectorPropertyInterface
557  bool tokenize(const std::string &str, std::vector<std::string> &vect, char openChar = '(',
558  char sepChar = ',', char closeChar = ')') override;
559 
560  bool setNodeStringValueAsVector(const node n, const std::vector<std::string> &values) override;
561 
562  bool setNodeStringValueAsVector(const node, const std::string &, char, char, char) override;
563 
564  bool setEdgeStringValueAsVector(const edge e, const std::vector<std::string> &values) override;
565 
566  bool setEdgeStringValueAsVector(const edge, const std::string &, char, char, char) override;
567 
568  /**
569  * @brief Sets the value for node n, at index i, to v, and notify the observers of a modification.
570  *
571  * @param n The node to set a value of.
572  * @param i The index at which the value should be set.
573  * @param v The value to set.
574  *
575  **/
576  void setNodeEltValue(const node n, unsigned int i,
577  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
578  /**
579  * @brief Gets the value associated to node n, at index i.
580  *
581  * @param n The node to set a value of.
582  * @param i The index at which to set the value.
583  * @return const eltType& The value at index i in the vector for node n.
584  **/
585  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue
586  getNodeEltValue(const node n, unsigned int i) const;
587  /**
588  * @brief Appends a new value at the end of the vector associated to node n, and notify the
589  *observers of a modification.
590  *
591  * @param n The node to add a value to.
592  * @param v The value to append at the end of the vector.
593  *
594  **/
595  void
596  pushBackNodeEltValue(const node n,
597  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
598  /**
599  * @brief Removes the value at the end of the vector associated to node n, and notify the
600  *observers of a modification.
601  *
602  * @param n The node to remove a value from.
603  *
604  **/
605  void popBackNodeEltValue(const node n);
606  /**
607  * @brief Resizes the vector associated to node n, and notify the observers of a modification.
608  *
609  * @param n The node associated to the vector to resize.
610  * @param size The new size of the vector.
611  * @param elt The default value to set at indices where there was no value before. Defaults to
612  *eltType().
613  *
614  **/
615  void resizeNodeValue(const node n, size_t size,
616  typename eltType::RealType elt = eltType::defaultValue());
617  /**
618  * @brief Sets the value for edge e, at index i, to v, and notify the observers of a modification.
619  *
620  * @param e The edge to set the value of.
621  * @param i The index at which the value should be set.
622  * @param v The value to set.
623  *
624  **/
625  void setEdgeEltValue(const edge e, unsigned int i,
626  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
627  /**
628  * @brief Gets the value associated to edge e, at index i.
629  *
630  * @param e The edge to set a value of.
631  * @param i The index at which to set the value.
632  * @return const eltType& The value at index i in the vector for node n.
633  **/
634  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue
635  getEdgeEltValue(const edge n, unsigned int i) const;
636  /**
637  * @brief Appends a new value at the end of the vector associated to edge e, and notify the
638  *observers of a modification.
639  *
640  * @param e The node to add a value to.
641  * @param v The value to append at the end of the vector.
642  *
643  **/
644  void
645  pushBackEdgeEltValue(const edge e,
646  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
647  /**
648  * @brief Removes the value at the end of the vector associated to edge e, and notify the
649  *observers of a modification.
650  *
651  * @param e The edge to remove a value from.
652  *
653  **/
654  void popBackEdgeEltValue(const edge e);
655  /**
656  * @brief Resizes the vector associated to edge e, and notify the observers of a modification.
657  *
658  * @param e The edge associated to the vector to resize.
659  * @param size The new size of the vector.
660  * @param elt The default value to set at indices where there was no value before. Defaults to
661  *eltType().
662  *
663  **/
664  void resizeEdgeValue(const edge e, size_t size,
665  typename eltType::RealType elt = eltType::defaultValue());
666 };
667 } // namespace tlp
668 #if !defined(_MSC_VER) || defined(DLL_TULIP) // When using VC++, we only want to include this when
669  // we are in the TULIP dll. With any other compiler,
670  // include it all the time
671 #include "cxx/AbstractProperty.cxx"
672 #endif
673 #endif
void erase(const edge e) override
Resets the value of an edge to the default value.
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
Tedge::RealType getEdgeDefaultValue() const
Gets the default edge value of the property.
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Graph.h:43
PropertyInterface describes the interface of a graph property.
virtual AbstractProperty< Tnode, Tedge, Tprop > & operator=(AbstractProperty< Tnode, Tedge, Tprop > &prop)
This operator overload allows to copy a property using the following syntax :
Tnode::RealType getNodeDefaultValue() const
Gets the default node value of the property.
tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue getNodeValue(const node n) const
Returns the value associated with the node n in this property. If there is no value, it returns the default node value.
tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue getEdgeValue(const edge e) const
Returns the value associated to the edge e in this property. If there is no value, it returns the default edge value.
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
void erase(const node n) override
Resets the value of a node to the default value.
This class is used to delegate the computation of the values associated to meta nodes or edges...
Base class for computing values on meta nodes and edges.
virtual void clone_handler(AbstractProperty< Tnode, Tedge, Tprop > &)
Enable to clone part of sub_class.
unsigned int id
id The identifier of the node.
Definition: Node.h:44
unsigned int id
id The identifier of the edge.
Definition: Edge.h:44