![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Classes for directed edge sets. More...
#include <arcGraphPart.h>
Public Attributes | |
Signaler2< NodeId, NodeId > | onArcAdded |
Signaler2< NodeId, NodeId > | onArcDeleted |
Public Member Functions | |
Constructors / Destructors | |
ArcGraphPart (Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true) | |
default constructor More... | |
ArcGraphPart (const ArcGraphPart &s) | |
copy constructor More... | |
virtual | ~ArcGraphPart () |
destructor More... | |
Operators | |
ArcGraphPart & | operator= (const ArcGraphPart &s) |
copy operator More... | |
bool | operator== (const ArcGraphPart &p) const |
tests whether two ArcGraphParts contain the same arcs More... | |
bool | operator!= (const ArcGraphPart &p) const |
tests whether two ArcGraphParts contain different arcs More... | |
Accessors/Modifiers | |
virtual void | addArc (NodeId tail, NodeId head) |
insert a new arc into the ArcGraphPart More... | |
virtual void | eraseArc (const Arc &arc) |
removes an arc from the ArcGraphPart More... | |
bool | existsArc (const Arc &arc) const |
indicates whether a given arc exists More... | |
bool | existsArc (NodeId tail, NodeId head) const |
indicates whether a given arc exists More... | |
bool | emptyArcs () const |
indicates wether the ArcGraphPart contains any arc More... | |
void | clearArcs () |
removes all the arcs from the ArcGraphPart More... | |
Size | sizeArcs () const |
indicates the number of arcs stored within the ArcGraphPart More... | |
const ArcSet & | arcs () const |
returns the set of arcs stored within the ArcGraphPart More... | |
const NodeSet & | parents (NodeId id) const |
returns the set of nodes with arc ingoing to a given node More... | |
NodeSet | family (NodeId id) const |
returns the set of nodes which consists in the node and its parents More... | |
NodeSet | descendants (NodeId id) const |
returns the set of nodes with directed path outgoing from a given node More... | |
NodeSet | ancestors (NodeId id) const |
returns the set of nodes with directed path ingoing to a given node More... | |
NodeSet | children (const NodeSet &ids) const |
returns the set of children of a set of nodes More... | |
NodeSet | parents (const NodeSet &ids) const |
returns the set of parents of a set of nodes More... | |
NodeSet | family (const NodeSet &ids) const |
returns the set of family nodes of a set of nodes More... | |
const NodeSet & | children (NodeId id) const |
returns the set of nodes with arc outgoing from a given node More... | |
void | eraseParents (NodeId id) |
erase all the parents of a given node More... | |
void | unvirtualizedEraseParents (NodeId id) |
same function as eraseParents but without any virtual call to an erase More... | |
void | eraseChildren (NodeId id) |
removes all the children of a given node More... | |
void | unvirtualizedEraseChildren (NodeId id) |
same function as eraseChildren but without any virtual call to an erase More... | |
std::string | toString () const |
to friendly display the content of the ArcGraphPart More... | |
template<typename VAL > | |
ArcProperty< VAL > | arcsProperty (VAL(*f)(const Arc &), Size size=0) const |
a method to create a hashMap of VAL from a set of arcs (using for every arc, say x, the VAL f(x)) More... | |
template<typename VAL > | |
ArcProperty< VAL > | arcsProperty (const VAL &a, Size size=0) const |
a method to create a hashMap of VAL from a set of arcs (using for every arc, say x, the VAL a) More... | |
template<typename VAL > | |
List< VAL > | listMapArcs (VAL(*f)(const Arc &)) const |
a method to create a list of VAL from a set of arcs (using for every arc, say x, the VAL f(x)) More... | |
std::vector< NodeId > | directedPath (NodeId node1, NodeId node2) const |
returns a directed path from node1 to node2 belonging to the set of arcs More... | |
std::vector< NodeId > | directedUnorientedPath (NodeId node1, NodeId node2) const |
returns an unoriented (directed) path from node1 to node2 in the arc set More... | |
Public Types | |
typedef ArcSetIterator | ArcIterator |
Protected Member Functions | |
void | eraseSetOfArcs_ (const ArcSet &set) |
a (virtualized) function to remove a given set of arcs More... | |
void | unvirtualizedEraseSetOfArcs_ (const ArcSet &set) |
similar to eraseSetOfArcs_ except that it is unvirtualized More... | |
Classes for directed edge sets.
Definition at line 78 of file arcGraphPart.h.
Definition at line 80 of file arcGraphPart.h.
|
explicit |
default constructor
arcs_size | the size of the hash table used to store all the arcs |
arcs_resize_policy | the resizing policy of this hash table |
Definition at line 38 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
gum::ArcGraphPart::ArcGraphPart | ( | const ArcGraphPart & | s | ) |
copy constructor
s | the ArcGraphPart to copy |
Definition at line 43 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
destructor
Definition at line 72 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
|
private |
when the ArcGraphPart contains no arc outgoing from a given node, this function adds an empty set entry to children[id]
id | the node whose children[id] is checked |
Definition at line 50 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
when the ArcGraphPart contains no arc ingoing into a given node, this function adds an empty set entry to parents[id]
id | the node whose parents[id] is checked |
Definition at line 46 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
insert a new arc into the ArcGraphPart
tail | the id of the tail of the new arc to be inserted |
head | the id of the head of the new arc to be inserted |
Reimplemented in gum::DiGraph, and gum::DAG.
Definition at line 94 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with directed path ingoing to a given node
Note that the set of nodes returned may be empty if no path within the ArcGraphPart is ingoing to the given node.
id | the node which is the head of a directed path with the returned nodes |
Definition at line 172 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE const ArcSet & gum::ArcGraphPart::arcs | ( | ) | const |
returns the set of arcs stored within the ArcGraphPart
Definition at line 38 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
ArcProperty< VAL > gum::ArcGraphPart::arcsProperty | ( | VAL(*)(const Arc &) | f, |
Size | size = 0 |
||
) | const |
a method to create a hashMap of VAL from a set of arcs (using for every arc, say x, the VAL f(x))
f | a function assigning a VAL to any arc |
size | an optional parameter enabling to fine-tune the returned Property. Roughly speaking, it is a good practice to have a size equal to half the number of arcs. If you do not specify this parameter, the method will assign it for you. |
ArcProperty< VAL > gum::ArcGraphPart::arcsProperty | ( | const VAL & | a, |
Size | size = 0 |
||
) | const |
a method to create a hashMap of VAL from a set of arcs (using for every arc, say x, the VAL a)
a | the default value assigned to each arc in the returned Property |
size | an optional parameter enabling to fine-tune the returned Property. Roughly speaking, it is a good practice to have a size equal to half the number of arcs. If you do not specify this parameter, the method will assign it for you. |
returns the set of children of a set of nodes
Definition at line 66 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with arc outgoing from a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is outgoing from the given node.
id | the node which is the tail of the arcs returned |
Definition at line 89 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
void gum::ArcGraphPart::clearArcs | ( | ) |
removes all the arcs from the ArcGraphPart
Definition at line 78 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with directed path outgoing from a given node
Note that the set of nodes returned may be empty if no path within the ArcGraphPart is outgoing from the given node.
id | the node which is the tail of a directed path with the returned nodes |
Definition at line 154 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
returns a directed path from node1 to node2 belonging to the set of arcs
node1 | the id from which the path begins |
node2 | the id to which the path ends |
NotFound | exception is raised if no path can be found between the two nodes |
Definition at line 190 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
std::vector< NodeId > gum::ArcGraphPart::directedUnorientedPath | ( | NodeId | node1, |
NodeId | node2 | ||
) | const |
returns an unoriented (directed) path from node1 to node2 in the arc set
node1 | the id from which the path begins |
node2 | the id to which the path ends |
NotFound | exception is raised if no path can be found between the two nodes |
Definition at line 231 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE bool gum::ArcGraphPart::emptyArcs | ( | ) | const |
indicates wether the ArcGraphPart contains any arc
Definition at line 34 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
removes an arc from the ArcGraphPart
arc | the arc to be removed |
Definition at line 106 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::ArcGraphPart::eraseChildren | ( | NodeId | id | ) |
removes all the children of a given node
id | the node all the children of which will be removed |
Definition at line 137 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::ArcGraphPart::eraseParents | ( | NodeId | id | ) |
erase all the parents of a given node
id | the node all the parents of which will be removed |
Definition at line 123 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
a (virtualized) function to remove a given set of arcs
Definition at line 118 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
indicates whether a given arc exists
arc | the arc we test whether or not it belongs to the ArcGraphPart |
Definition at line 40 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
indicates whether a given arc exists
tail | the tail of the arc we test the existence in the ArcGraphPart |
head | the head of the arc we test the existence in the ArcGraphPart |
Definition at line 42 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes which consists in the node and its parents
Note that the set of nodes returned may be empty if no path within the ArcGraphPart is outgoing from the given node.
id | the node which is the tail of a directed path with the returned nodes |
Definition at line 59 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of family nodes of a set of nodes
Definition at line 82 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
a method to create a list of VAL from a set of arcs (using for every arc, say x, the VAL f(x))
f | a function assigning a VAL to any arc |
INLINE bool gum::ArcGraphPart::operator!= | ( | const ArcGraphPart & | p | ) | const |
tests whether two ArcGraphParts contain different arcs
p | the ArcGraphPart that we compare with this |
Definition at line 182 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
ArcGraphPart & gum::ArcGraphPart::operator= | ( | const ArcGraphPart & | s | ) |
copy operator
s | the ArcGraphPart to copy |
Definition at line 101 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE bool gum::ArcGraphPart::operator== | ( | const ArcGraphPart & | p | ) | const |
tests whether two ArcGraphParts contain the same arcs
p | the ArcGraphPart that we compare with this |
Definition at line 180 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of nodes with arc ingoing to a given node
Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.
id | the node toward which the arcs returned are pointing |
Definition at line 54 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
returns the set of parents of a set of nodes
Definition at line 74 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Size gum::ArcGraphPart::sizeArcs | ( | ) | const |
indicates the number of arcs stored within the ArcGraphPart
Definition at line 36 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
std::string gum::ArcGraphPart::toString | ( | ) | const |
to friendly display the content of the ArcGraphPart
Definition at line 134 of file arcGraphPart.cpp.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::ArcGraphPart::unvirtualizedEraseChildren | ( | NodeId | id | ) |
same function as eraseChildren but without any virtual call to an erase
id | the node whose outgoing arcs will be removed |
Definition at line 168 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::ArcGraphPart::unvirtualizedEraseParents | ( | NodeId | id | ) |
same function as eraseParents but without any virtual call to an erase
id | the node whose ingoing arcs will be removed |
Definition at line 156 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
similar to eraseSetOfArcs_ except that it is unvirtualized
Definition at line 151 of file arcGraphPart_inl.h.
References gum::Set< Key, Alloc >::emplace().
the set of all the arcs contained within the ArcGraphPart
Definition at line 301 of file arcGraphPart.h.
|
mutableprivate |
for each arc, the set of its children
Definition at line 307 of file arcGraphPart.h.
|
mutableprivate |
for each arc, the sets of its parents
Definition at line 304 of file arcGraphPart.h.
Definition at line 82 of file arcGraphPart.h.
Definition at line 83 of file arcGraphPart.h.