aGrUM  0.14.2
undiGraph_inl.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more deseconds. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 // to ease parser
28 #include <agrum/graphs/undiGraph.h>
29 
30 namespace gum {
31 
32  INLINE void UndiGraph::addEdge(const NodeId first, const NodeId second) {
33  if (!exists(first)) { GUM_ERROR(InvalidNode, "first node"); }
34 
35  if (!exists(second)) { GUM_ERROR(InvalidNode, "second node"); }
36 
37  EdgeGraphPart::addEdge(second, first);
38  }
39 
40  INLINE void UndiGraph::clear() {
43  }
44 
46  if (this != &g) {
50  }
51 
52  return *this;
53  }
54 
55  INLINE void UndiGraph::eraseNode(const NodeId id) {
56  // warning: to remove the edges adjacent to id, use the unvirtualized
57  // versions
58  // of edge removals
61  }
62 
63  INLINE bool UndiGraph::operator==(const UndiGraph& p) const {
65  }
66 
67  INLINE bool UndiGraph::operator!=(const UndiGraph& p) const {
68  return !operator==(p);
69  }
70 
71 } /* namespace gum */
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
virtual void clear()
removes all the nodes and edges from the graph
Definition: undiGraph_inl.h:40
bool operator==(const EdgeGraphPart &p) const
tests whether two EdgeGraphParts contain the same edges
EdgeGraphPart & operator=(const EdgeGraphPart &s)
copy operator
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:32
virtual void addEdge(const NodeId n1, const NodeId n2)
insert a new edge into the EdgeGraphPart
Base classes for undirected graphs.
bool exists(const NodeId id) const
alias for existsNode
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
bool operator==(const NodeGraphPart &p) const
check whether two NodeGraphParts contain the same nodes
virtual void eraseNode(const NodeId id)
remove a node and its adjacent edges from the graph
Definition: undiGraph_inl.h:55
virtual void clearEdges()
removes all the edges from the EdgeGraphPart
bool operator!=(const UndiGraph &g) const
tests whether two UndiGraphs are different
Definition: undiGraph_inl.h:67
bool operator==(const UndiGraph &g) const
tests whether two UndiGraphs are identical (same nodes, same edges)
Definition: undiGraph_inl.h:63
Base class for undirected graphs.
Definition: undiGraph.h:106
virtual void clearNodes()
remove all the nodes from the NodeGraphPart
void unvirtualizedEraseNeighbours(const NodeId id)
same function as eraseNeighbours but without any virtual call to an erase
UndiGraph & operator=(const UndiGraph &g)
copy operator
Definition: undiGraph_inl.h:45
Size NodeId
Type for node ids.
Definition: graphElements.h:97
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
virtual void eraseNode(const NodeId id)
erase the node with the given id