aGrUM  0.16.0
DAG_inl.h
Go to the documentation of this file.
1 
30 // to ease IDE parser
31 #include <agrum/core/exceptions.h>
32 #include <agrum/graphs/DAG.h>
33 
34 namespace gum {
35 
36  INLINE DAG& DAG::operator=(const DAG& g) {
37  // avoid self assignment
38  if (this != &g) { DiGraph::operator=(g); }
39 
40  return *this;
41  }
42 
43  INLINE void DAG::addArc(const NodeId tail, const NodeId head) {
44  if (hasDirectedPath(head, tail)) {
45  GUM_ERROR(InvalidDirectedCycle, "Add a directed cycle in a dag !");
46  }
47 
48  // checking whether tail and head do belong to the graph is performed
49  // within class DiGraph
50  DiGraph::addArc(tail, head);
51  }
52 
53 } /* namespace gum */
DiGraph & operator=(const DiGraph &g)
copy operator
Definition: diGraph_inl.h:48
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
Definition: diGraph_inl.h:35
DAG & operator=(const DAG &g)
copy operator
Definition: DAG_inl.h:36
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
Definition: DAG_inl.h:43
bool hasDirectedPath(const NodeId from, const NodeId to)
checks whether there exists a directed path from from to to
Definition: diGraph.cpp:137
Base class for dag.
Definition: DAG.h:102
Size NodeId
Type for node ids.
Definition: graphElements.h:98
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55