aGrUM  0.16.0
mixedGraph.h
Go to the documentation of this file.
1 
28 #ifndef GUM_MIXED_GRAPH_H
29 #define GUM_MIXED_GRAPH_H
30 
31 #include <iostream>
32 #include <utility>
33 
34 #include <agrum/agrum.h>
35 
36 #include <agrum/graphs/diGraph.h>
37 #include <agrum/graphs/undiGraph.h>
38 
39 namespace gum {
40 
41  /* ===========================================================================
42  */
43  /* === BASE CLASS FOR MANIPULATING GRAPHS WITH BOTH EDGES AND ARCS ===
44  */
45  /* ===========================================================================
46  */
124  /* ===========================================================================
125  */
126 
128  : public virtual UndiGraph
129  , public virtual DiGraph {
130  public:
131  // ############################################################################
133  // ############################################################################
135 
137 
143  explicit MixedGraph(Size nodes_size = HashTableConst::default_size,
144  bool nodes_resize_policy = true,
146  bool arcs_resize_policy = true,
147  Size edges_size = HashTableConst::default_size,
148  bool edges_resize_policy = true);
149 
151 
152  MixedGraph(const MixedGraph& g);
153 
155  virtual ~MixedGraph();
156 
158 
159  // ############################################################################
161  // ############################################################################
163 
165 
166  MixedGraph& operator=(const MixedGraph& g);
167 
169 
170  // not virtual : it is a feature !!! :)
171  bool operator==(const MixedGraph& g) const;
172 
174 
175  // not virtual : it is a feature !!! :)
176  bool operator!=(const MixedGraph& g) const;
177 
179 
180  // ############################################################################
182  // ############################################################################
184 
186 
189  virtual void eraseNode(const NodeId id);
190 
192  virtual void clear();
193 
203  const std::vector< NodeId > mixedOrientedPath(const NodeId node1,
204  const NodeId node2) const;
205 
207 
213  const std::vector< NodeId > mixedUnorientedPath(const NodeId node1,
214  const NodeId node2) const;
215 
217  virtual const std::string toDot() const;
218 
220  virtual const std::string toString() const;
221 
223  };
224 
226  std::ostream& operator<<(std::ostream&, const MixedGraph&);
227 
228 } /* namespace gum */
229 
230 #ifndef GUM_NO_INLINE
232 #endif // GUM_NOINLINE
233 
234 #endif /* GUM_MIXEDGRAPH_H */
const std::vector< NodeId > mixedUnorientedPath(const NodeId node1, const NodeId node2) const
returns a mixed/directed path from node1 to node2 in the arc/edge set
Definition: mixedGraph.cpp:136
MixedGraph & operator=(const MixedGraph &g)
copy operator
virtual void clear()
removes all the nodes, arcs and edges from the graph
bool operator!=(const MixedGraph &g) const
tests whether two MixedGraphs are different
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual const std::string toString() const
to friendly display the content of the MixedGraph
Definition: mixedGraph.cpp:64
static constexpr Size default_size
The default number of slots in hashtables.
Definition: hashTable.h:80
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
virtual void eraseNode(const NodeId id)
remove a node as well as its adjacent arcs and edges from the graph
virtual const std::string toDot() const
to friendly display mixed graph in DOT format
Definition: mixedGraph.cpp:217
std::ostream & operator<<(std::ostream &output, const BayesNet< GUM_SCALAR > &bn)
Prints map&#39;s DAG in output using the Graphviz-dot format.
Definition: BayesNet_tpl.h:605
Base class for all oriented graphs.
Definition: diGraph.h:111
bool operator==(const MixedGraph &g) const
tests whether two MixedGraphs are identical (same nodes, arcs and edges)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
MixedGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true, Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
Definition: mixedGraph.cpp:37
Base class for undirected graphs.
Definition: undiGraph.h:109
const std::vector< NodeId > mixedOrientedPath(const NodeId node1, const NodeId node2) const
returns a mixed edge/directed arc path from node1 to node2 in the arc/edge set
Definition: mixedGraph.cpp:74
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Size NodeId
Type for node ids.
Definition: graphElements.h:98
virtual ~MixedGraph()
destructor
Definition: mixedGraph.cpp:59
Base class for mixed graphs.
Definition: mixedGraph.h:127