![]() |
aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
|
Classes for directed edge sets. More...
#include <arcGraphPart.h>
Public Types | |
| using | ArcIterator = ArcSetIterator |
Public Member Functions | |
Constructors / Destructors | |
| ArcGraphPart (Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true) | |
| default constructor | |
| ArcGraphPart (const ArcGraphPart &s) | |
| copy constructor | |
| ArcGraphPart (ArcGraphPart &&s) | |
| move constructor | |
| virtual | ~ArcGraphPart () |
| destructor | |
Operators | |
| ArcGraphPart & | operator= (const ArcGraphPart &s) |
| copy operator | |
| ArcGraphPart & | operator= (ArcGraphPart &&s) |
| move assignment operator | |
| bool | operator== (const ArcGraphPart &p) const |
| tests whether two ArcGraphParts contain the same arcs | |
Accessors/Modifiers | |
| virtual void | addArc (NodeId tail, NodeId head) |
| insert a new arc into the ArcGraphPart | |
| virtual void | eraseArc (const Arc &arc) |
| removes an arc from the ArcGraphPart | |
| bool | existsArc (const Arc &arc) const |
| indicates whether a given arc exists | |
| bool | existsArc (NodeId tail, NodeId head) const |
| indicates whether a given arc exists | |
| bool | emptyArcs () const |
| indicates wether the ArcGraphPart contains any arc | |
| void | clearArcs () |
| removes all the arcs from the ArcGraphPart | |
| Size | sizeArcs () const |
| indicates the number of arcs stored within the ArcGraphPart | |
| const ArcSet & | arcs () const |
| returns the set of arcs stored within the ArcGraphPart | |
| const NodeSet & | parents (NodeId id) const |
| returns the set of nodes with arc ingoing to a given node | |
| NodeSet | children (const NodeSet &ids) const |
| returns the set of nodes which consists in the node and its parents returns the set of children of a set of nodes | |
| NodeSet | parents (const NodeSet &ids) const |
| returns the set of parents of a set of nodes | |
| const NodeSet & | children (NodeId id) const |
| returns the set of nodes with arc outgoing from a given node | |
| void | eraseParents (NodeId id) |
| erase all the parents of a given node | |
| void | unvirtualizedEraseParents (NodeId id) |
| same function as eraseParents but without any virtual call to an erase | |
| void | eraseChildren (NodeId id) |
| removes all the children of a given node | |
| void | unvirtualizedEraseChildren (NodeId id) |
| same function as eraseChildren but without any virtual call to an erase | |
| std::string | toString () const |
| to friendly display the content of the ArcGraphPart | |
| 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)) | |
| 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) | |
| 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)) | |
Public Attributes | |
| Signaler< NodeId, NodeId > | onArcAdded |
| Signaler< NodeId, NodeId > | onArcDeleted |
Protected Member Functions | |
| void | eraseSetOfArcs_ (const ArcSet &set) |
| a (virtualized) function to remove a given set of arcs | |
| void | unvirtualizedEraseSetOfArcs_ (const ArcSet &set) |
| similar to eraseSetOfArcs_ except that it is unvirtualized | |
Private Member Functions | |
| void | _checkParents_ (NodeId id) |
| when the ArcGraphPart contains no arc ingoing into a given node, this function adds an empty set entry to parents[id] | |
| void | _checkChildren_ (NodeId id) |
| when the ArcGraphPart contains no arc outgoing from a given node, this function adds an empty set entry to children[id] | |
Private Attributes | |
| Set< Arc > | _arcs_ |
| the set of all the arcs contained within the ArcGraphPart | |
| NodeProperty< NodeSet * > | _parents_ |
| for each arc, the sets of its parents | |
| NodeProperty< NodeSet * > | _children_ |
| for each arc, the set of its children | |
Classes for directed edge sets.
Definition at line 98 of file arcGraphPart.h.
Definition at line 100 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 58 of file arcGraphPart.cpp.
References ArcGraphPart(), and _arcs_.
Referenced by ArcGraphPart(), ArcGraphPart(), ArcGraphPart(), gum::DiGraph::DiGraph(), gum::DiGraph::DiGraph(), gum::DiGraph::DiGraph(), ~ArcGraphPart(), operator=(), operator=(), and operator==().
| gum::ArcGraphPart::ArcGraphPart | ( | const ArcGraphPart & | s | ) |
copy constructor
| s | the ArcGraphPart to copy |
Definition at line 69 of file arcGraphPart.cpp.
References ArcGraphPart(), _arcs_, _children_, _parents_, gum::HashTable< Key, Val >::capacity(), children(), GUM_EMIT2, and onArcAdded.
| gum::ArcGraphPart::ArcGraphPart | ( | ArcGraphPart && | s | ) |
move constructor
Definition at line 63 of file arcGraphPart.cpp.
References ArcGraphPart(), _arcs_, _children_, and _parents_.
|
virtual |
destructor
Definition at line 98 of file arcGraphPart.cpp.
References ArcGraphPart(), and clearArcs().
|
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 72 of file arcGraphPart_inl.h.
References _children_.
Referenced by addArc().
|
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 68 of file arcGraphPart_inl.h.
References _parents_.
Referenced by addArc().
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::DAG, gum::DiGraph, gum::PDAG, and gum::prm::gspan::Pattern.
Definition at line 102 of file arcGraphPart_inl.h.
References _arcs_, _checkChildren_(), _checkParents_(), _children_, _parents_, GUM_EMIT2, and onArcAdded.
Referenced by gum::DiGraph::addArc().
| INLINE const ArcSet & gum::ArcGraphPart::arcs | ( | ) | const |
returns the set of arcs stored within the ArcGraphPart
Definition at line 60 of file arcGraphPart_inl.h.
References _arcs_.
Referenced by gum::EssentialGraph::_buildEssentialGraph_(), gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_(), gum::prm::ClassBayesNet< GUM_SCALAR >::_init_(), gum::prm::gspan::Pattern::arcs(), gum::learning::FCI::learnPAG(), gum::learning::SimpleMiic::learnStructure(), and gum::DiGraph::toDot().
| 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. |
| ArcProperty< VAL > gum::ArcGraphPart::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))
| 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. |
returns the set of nodes which consists in the node and its parents returns the set of children of a set of nodes
returns the set of children of a set of nodes
Definition at line 82 of file arcGraphPart_inl.h.
References children().
Referenced by ArcGraphPart(), gum::prm::ClassDependencyGraph< GUM_SCALAR >::_addArcs_(), gum::EssentialGraph::_buildEssentialGraph_(), gum::DoorCriteria::_existsUnblockedDirectedPath_(), gum::prm::gspan::Pattern::_expandCodeIsMinimal_(), gum::prm::SVE< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVED< GUM_SCALAR >::_initElimOrder_(), gum::prm::gspan::Pattern::_not_rec_(), gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::prm::gspan::Pattern::_rec_(), gum::DoCalculus< GUM_SCALAR >::_removeInIntoDoing_outOfKnowing_(), gum::BarrenNodesFinder::barrenNodes(), children(), gum::DoorCriteria::enumerateFrontdoorSets(), eraseChildren(), gum::PDAG::hasMixedReallyOrientedPath(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::initialize_(), gum::Separation::isBackdoorSeparated(), gum::Separation::isForwardSeparated(), gum::prm::gspan::Pattern::isMinimal(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_(), operator<<(), gum::learning::SimpleMiic::propagatesOrientationInChainOfRemainingEdges_(), gum::rec_hasMixedReallyOrientedPath(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::prm::gspan::Pattern::remove(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGCycleDetector::setDAG(), gum::MixedGraph::toDot(), gum::PDAG::toDot(), and unvirtualizedEraseChildren().
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 97 of file arcGraphPart_inl.h.
References _children_, and gum::emptyNodeSet.
| void gum::ArcGraphPart::clearArcs | ( | ) |
removes all the arcs from the ArcGraphPart
Definition at line 104 of file arcGraphPart.cpp.
References _arcs_, _children_, _parents_, GUM_EMIT2, and onArcDeleted.
Referenced by ~ArcGraphPart(), gum::DiGraph::clear(), gum::MixedGraph::clear(), operator=(), operator=(), and gum::MixedGraph::operator=().
| INLINE bool gum::ArcGraphPart::emptyArcs | ( | ) | const |
indicates wether the ArcGraphPart contains any arc
Definition at line 56 of file arcGraphPart_inl.h.
References _arcs_.
|
virtual |
removes an arc from the ArcGraphPart
| arc | the arc to be removed |
Definition at line 114 of file arcGraphPart_inl.h.
References _arcs_, _children_, _parents_, existsArc(), GUM_EMIT2, gum::Arc::head(), onArcDeleted, and gum::Arc::tail().
Referenced by gum::EssentialGraph::_buildEssentialGraph_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::MeekRules::_orientDoubleHeadedArcs_(), gum::DoCalculus< GUM_SCALAR >::_removeIncomingInto_(), gum::DoCalculus< GUM_SCALAR >::_removeInIntoDoing_outOfKnowing_(), gum::BarrenNodesFinder::barrenNodes(), eraseChildren(), eraseParents(), eraseSetOfArcs_(), gum::Separation::isBackdoorSeparated(), gum::learning::IBNLearner::learnDag_(), gum::learning::SimpleMiic::learnStructure(), gum::learning::ConstraintBasedLearning::orientDoubleHeadedArcs_(), gum::prm::gspan::Pattern::pop_back(), gum::BayesNet< GUM_SCALAR >::reverseArc(), unvirtualizedEraseChildren(), unvirtualizedEraseParents(), and unvirtualizedEraseSetOfArcs_().
| 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 146 of file arcGraphPart_inl.h.
References _children_, children(), and eraseArc().
| 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 132 of file arcGraphPart_inl.h.
References _parents_, eraseArc(), and parents().
|
protected |
a (virtualized) function to remove a given set of arcs
Definition at line 127 of file arcGraphPart_inl.h.
References eraseArc().
indicates whether a given arc exists
| arc | the arc we test whether or not it belongs to the ArcGraphPart |
Definition at line 62 of file arcGraphPart_inl.h.
References _arcs_.
Referenced by gum::DoorCriteria::_existsUnblockedDirectedPath_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::gspan::Pattern::_not_rec_(), gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::prm::gspan::Pattern::_rec_(), gum::EssentialGraph::_strongly_protected_(), gum::DoorCriteria::enumerateBackdoorSets(), eraseArc(), gum::prm::gspan::Pattern::exists(), gum::Separation::isBackdoorSeparated(), and gum::graph::markovBlanket().
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 64 of file arcGraphPart_inl.h.
References _parents_.
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 |
| ArcGraphPart & gum::ArcGraphPart::operator= | ( | ArcGraphPart && | s | ) |
move assignment operator
Definition at line 162 of file arcGraphPart.cpp.
References ArcGraphPart(), _arcs_, _children_, _parents_, clearArcs(), GUM_EMIT2, and onArcAdded.
| ArcGraphPart & gum::ArcGraphPart::operator= | ( | const ArcGraphPart & | s | ) |
copy operator
| s | the ArcGraphPart to copy |
Definition at line 127 of file arcGraphPart.cpp.
References ArcGraphPart(), _arcs_, _children_, _parents_, clearArcs(), GUM_EMIT2, and onArcAdded.
Referenced by gum::DiGraph::operator=(), gum::DiGraph::operator=(), gum::MixedGraph::operator=(), and gum::MixedGraph::operator=().
| 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 189 of file arcGraphPart_inl.h.
References ArcGraphPart(), and _arcs_.
Referenced by gum::DiGraph::operator==(), and gum::MixedGraph::operator==().
returns the set of parents of a set of nodes
Definition at line 90 of file arcGraphPart_inl.h.
References parents().
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 76 of file arcGraphPart_inl.h.
References _parents_, and gum::emptyNodeSet.
Referenced by gum::DoCalculus< GUM_SCALAR >::_ancestorsIn_(), gum::prm::gspan::Pattern::_expandCodeIsMinimal_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClass_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClasses_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateCluster_(), gum::prm::SVE< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVED< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVE< GUM_SCALAR >::_initLiftedNodes_(), gum::prm::SVED< GUM_SCALAR >::_initLiftedNodes_(), gum::prm::gspan::Pattern::_not_rec_(), gum::MeekRules::_orientDoubleHeadedArcs_(), gum::prm::gspan::Pattern::_rec_(), gum::DoCalculus< GUM_SCALAR >::_removeIncomingInto_(), gum::DoCalculus< GUM_SCALAR >::_removeInIntoDoing_outOfKnowing_(), gum::EssentialGraph::_strongly_protected_(), gum::DoorCriteria::backdoorReach(), gum::BarrenNodesFinder::barrenNodes(), gum::DoorCriteria::enumerateBackdoorSets(), gum::DoorCriteria::enumerateFrontdoorSets(), eraseParents(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::initialize_(), gum::prm::gspan::Pattern::isMinimal(), gum::learning::SimpleMiic::learnPDAG(), gum::learning::SimpleMiic::learnStructure(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::makeInferenceNodeToNeighbours_(), operator<<(), gum::learning::ConstraintBasedLearning::orientDoubleHeadedArcs_(), gum::prm::gspan::DFSTree< GUM_SCALAR >::parent(), gum::prm::gspan::DFSTree< GUM_SCALAR >::parent(), parents(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::prm::gspan::Pattern::remove(), gum::dSeparationAlgorithm::requisiteNodes(), gum::prm::gspan::Pattern::rightmostPath(), gum::DAGCycleDetector::setDAG(), and unvirtualizedEraseParents().
| INLINE Size gum::ArcGraphPart::sizeArcs | ( | ) | const |
indicates the number of arcs stored within the ArcGraphPart
Definition at line 58 of file arcGraphPart_inl.h.
References _arcs_.
Referenced by gum::prm::gspan::Pattern::sizeArcs().
| std::string gum::ArcGraphPart::toString | ( | ) | const |
to friendly display the content of the ArcGraphPart
Definition at line 178 of file arcGraphPart.cpp.
References _arcs_.
Referenced by gum::operator<<(), gum::DiGraph::toString(), and gum::MixedGraph::toString().
| 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 177 of file arcGraphPart_inl.h.
References _children_, children(), and eraseArc().
Referenced by gum::DiGraph::eraseNode(), and gum::MixedGraph::eraseNode().
| 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 165 of file arcGraphPart_inl.h.
References _parents_, eraseArc(), and parents().
Referenced by gum::DiGraph::eraseNode(), and gum::MixedGraph::eraseNode().
|
protected |
similar to eraseSetOfArcs_ except that it is unvirtualized
Definition at line 160 of file arcGraphPart_inl.h.
References eraseArc().
the set of all the arcs contained within the ArcGraphPart
Definition at line 281 of file arcGraphPart.h.
Referenced by ArcGraphPart(), ArcGraphPart(), ArcGraphPart(), addArc(), arcs(), clearArcs(), emptyArcs(), eraseArc(), existsArc(), operator=(), operator=(), operator==(), sizeArcs(), and toString().
|
private |
for each arc, the set of its children
Definition at line 287 of file arcGraphPart.h.
Referenced by ArcGraphPart(), ArcGraphPart(), _checkChildren_(), addArc(), children(), clearArcs(), eraseArc(), eraseChildren(), operator=(), operator=(), and unvirtualizedEraseChildren().
|
private |
for each arc, the sets of its parents
Definition at line 284 of file arcGraphPart.h.
Referenced by ArcGraphPart(), ArcGraphPart(), _checkParents_(), addArc(), clearArcs(), eraseArc(), eraseParents(), existsArc(), operator=(), operator=(), parents(), and unvirtualizedEraseParents().
Definition at line 102 of file arcGraphPart.h.
Referenced by ArcGraphPart(), addArc(), operator=(), and operator=().
Definition at line 103 of file arcGraphPart.h.
Referenced by clearArcs(), and eraseArc().