aGrUM  0.16.0
diGraph_inl.h
Go to the documentation of this file.
1 
30 // to ease parser in IDEs
31 #include <agrum/graphs/diGraph.h>
32 
33 namespace gum {
34 
35  INLINE void DiGraph::addArc(const NodeId tail, const NodeId head) {
36  if (!exists(head)) { GUM_ERROR(InvalidNode, "head node"); }
37 
38  if (!exists(tail)) { GUM_ERROR(InvalidNode, "tail node"); }
39 
40  ArcGraphPart::addArc(tail, head);
41  }
42 
43  INLINE void DiGraph::clear() {
46  }
47 
48  INLINE DiGraph& DiGraph::operator=(const DiGraph& g) {
49  // avoid self assigment
50  if (this != &g) {
54 
55  if (__mutableTopologicalOrder != nullptr) {
57  __mutableTopologicalOrder = nullptr;
58  }
59 
60  if (g.__mutableTopologicalOrder != nullptr) {
63  }
64  }
65 
66  return *this;
67  }
68 
69  INLINE void DiGraph::eraseNode(const NodeId id) {
70  // warning: to remove the arcs adjacent to id, use the unvirtualized
71  // versions
72  // of arc removals
75 
77  }
78 
79  INLINE bool DiGraph::operator==(const DiGraph& p) const {
81  }
82 
83  INLINE bool DiGraph::operator!=(const DiGraph& p) const {
84  return !operator==(p);
85  }
86 
87 } /* namespace gum */
DiGraph & operator=(const DiGraph &g)
copy operator
Definition: diGraph_inl.h:48
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
Definition: diGraph_inl.h:35
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool operator!=(const DiGraph &g) const
tests whether two DiGraphs are different
Definition: diGraph_inl.h:83
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the ArcGraphPart
ArcGraphPart & operator=(const ArcGraphPart &s)
copy operator
void clearArcs()
removes all the arcs from the ArcGraphPart
virtual void clear()
removes all the nodes and arcs from the graph
Definition: diGraph_inl.h:43
bool exists(const NodeId id) const
alias for existsNode
bool operator==(const DiGraph &g) const
tests whether two DiGraphs are identical (same nodes, same arcs)
Definition: diGraph_inl.h:79
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
bool operator==(const NodeGraphPart &p) const
check whether two NodeGraphParts contain the same nodes
Sequence< NodeId > * __mutableTopologicalOrder
The topology sequence of this Directed Graphical Model.
Definition: diGraph.h:212
bool operator==(const ArcGraphPart &p) const
tests whether two ArcGraphParts contain the same arcs
Base class for all oriented graphs.
Definition: diGraph.h:111
virtual void clearNodes()
remove all the nodes from the NodeGraphPart
void unvirtualizedEraseChildren(const NodeId id)
same function as eraseChildren but without any virtual call to an erase
void unvirtualizedEraseParents(const NodeId id)
same function as eraseParents but without any virtual call to an erase
virtual void eraseNode(const NodeId id)
remove a node and its adjacent arcs from the graph
Definition: diGraph_inl.h:69
Size NodeId
Type for node ids.
Definition: graphElements.h:98
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
virtual void eraseNode(const NodeId id)
erase the node with the given id