aGrUM  0.17.2
a C++ library for (probabilistic) graphical models
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 
38 
39 namespace gum {
40 
41  /* ===========================================================================
42  */
43  /* === BASE CLASS FOR MANIPULATING GRAPHS WITH BOTH EDGES AND ARCS ===
44  */
45  /* ===========================================================================
46  */
124  /* ===========================================================================
125  */
126 
127  class MixedGraph: public virtual UndiGraph, public virtual DiGraph {
128  public:
129  // ############################################################################
131  // ############################################################################
133 
135 
141  explicit MixedGraph(Size nodes_size = HashTableConst::default_size,
142  bool nodes_resize_policy = true,
144  bool arcs_resize_policy = true,
145  Size edges_size = HashTableConst::default_size,
146  bool edges_resize_policy = true);
147 
149 
150  MixedGraph(const MixedGraph& g);
151 
153  virtual ~MixedGraph();
154 
156 
157  // ############################################################################
159  // ############################################################################
161 
163 
164  MixedGraph& operator=(const MixedGraph& g);
165 
167 
168  // not virtual : it is a feature !!! :)
169  bool operator==(const MixedGraph& g) const;
170 
172 
173  // not virtual : it is a feature !!! :)
174  bool operator!=(const MixedGraph& g) const;
175 
177 
178  // ############################################################################
180  // ############################################################################
182 
184 
187  virtual void eraseNode(const NodeId id);
188 
190  virtual void clear();
191 
201  const std::vector< NodeId > mixedOrientedPath(const NodeId node1,
202  const NodeId node2) const;
203 
205 
211  const std::vector< NodeId > mixedUnorientedPath(const NodeId node1,
212  const NodeId node2) const;
213 
215  virtual const std::string toDot() const;
216 
218  virtual const std::string toString() const;
219 
221  };
222 
224  std::ostream& operator<<(std::ostream&, const MixedGraph&);
225 
226 } /* namespace gum */
227 
228 #ifndef GUM_NO_INLINE
230 #endif // GUM_NOINLINE
231 
232 #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-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
Copyright 2005-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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:626
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-2020 Pierre-Henri WUILLEMIN () et Christophe GONZALES () info_at_agrum_dot_org.
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