![]() |
aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
|
Classes for undirected edge sets. More...
#include <edgeGraphPart.h>
Public Types | |
| using | EdgeIterator = EdgeSetIterator |
Public Member Functions | |
Constructors / Destructors | |
| EdgeGraphPart (Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true) | |
| default constructor | |
| EdgeGraphPart (const EdgeGraphPart &s) | |
| copy constructor | |
| EdgeGraphPart (EdgeGraphPart &&s) | |
| move constructor | |
| virtual | ~EdgeGraphPart () |
| destructor | |
Operators | |
| EdgeGraphPart & | operator= (const EdgeGraphPart &s) |
| copy operator | |
| EdgeGraphPart & | operator= (EdgeGraphPart &&s) |
| move assignment operator | |
| bool | operator== (const EdgeGraphPart &p) const |
| tests whether two EdgeGraphParts contain the same edges | |
Accessors/Modifiers | |
| virtual void | addEdge (NodeId n1, NodeId n2) |
| insert a new edge into the EdgeGraphPart | |
| virtual void | eraseEdge (const Edge &edge) |
| removes an edge from the EdgeGraphPart | |
| bool | existsEdge (const Edge &edge) const |
| indicates whether a given edge exists | |
| bool | existsEdge (NodeId n1, NodeId n2) const |
| indicates whether a given edge exists | |
| bool | emptyEdges () const |
| indicates wether the EdgeGraphPart contains any edge | |
| virtual void | clearEdges () |
| removes all the edges from the EdgeGraphPart | |
| Size | sizeEdges () const |
| indicates the number of edges stored within the EdgeGraphPart | |
| const EdgeSet & | edges () const |
| returns the set of edges stored within the EdgeGraphPart | |
| const NodeSet & | neighbours (NodeId id) const |
| returns the set of node neighbours to a given node | |
| void | eraseNeighbours (NodeId id) |
| erase all the edges adjacent to a given node | |
| void | unvirtualizedEraseNeighbours (NodeId id) |
| same function as eraseNeighbours but without any virtual call to an erase | |
| virtual std::string | toString () const |
| to friendly display the content of the EdgeGraphPart | |
| template<typename VAL> | |
| EdgeProperty< VAL > | edgesProperty (VAL(*f)(const Edge &), Size size=0) const |
| a method to create a hashMap of VAL from a set of edges (using for every edge, say x, the VAL f(x)) | |
| template<typename VAL> | |
| EdgeProperty< VAL > | edgesProperty (const VAL &val, Size size=0) const |
| a method to create a hashMap of VAL from a set of edges (using for every edge, say x, the VAL a) | |
| template<typename VAL> | |
| List< VAL > | listMapEdges (VAL(*f)(const Edge &)) const |
| a method to create a list of VAL from a set of edges (using for every edge, say x, the VAL f(x)) | |
Public Attributes | |
| Signaler< NodeId, NodeId > | onEdgeAdded |
| Signaler< NodeId, NodeId > | onEdgeDeleted |
Private Member Functions | |
| void | _checkNeighbours_ (NodeId id) |
| when the EdgeGraphPart contains no edge adjacent to a given node, this function adds an empty set entry to neighbours[id] | |
| void | _clearEdges_ () |
Private Attributes | |
| EdgeSet | _edges_ |
| the set of all the edges contained within the EdgeGraphPart | |
| NodeProperty< NodeSet * > | _neighbours_ |
| for each node, the set of its adjacent edges | |
Classes for undirected edge sets.
Definition at line 94 of file edgeGraphPart.h.
Definition at line 96 of file edgeGraphPart.h.
|
explicit |
default constructor
| edges_size | the size of the hash table used to store all the edges |
| edges_resize_policy | the resizing policy of this hash table |
Definition at line 58 of file edgeGraphPart.cpp.
References EdgeGraphPart(), and _edges_.
Referenced by EdgeGraphPart(), EdgeGraphPart(), EdgeGraphPart(), gum::UndiGraph::UndiGraph(), gum::UndiGraph::UndiGraph(), gum::UndiGraph::UndiGraph(), ~EdgeGraphPart(), operator=(), operator=(), and operator==().
| gum::EdgeGraphPart::EdgeGraphPart | ( | const EdgeGraphPart & | s | ) |
copy constructor
| s | the EdgeGraphPart to copy |
Definition at line 68 of file edgeGraphPart.cpp.
References EdgeGraphPart(), _edges_, _neighbours_, GUM_EMIT2, and onEdgeAdded.
| gum::EdgeGraphPart::EdgeGraphPart | ( | EdgeGraphPart && | s | ) |
move constructor
Definition at line 63 of file edgeGraphPart.cpp.
References EdgeGraphPart(), _edges_, and _neighbours_.
|
virtual |
destructor
Definition at line 85 of file edgeGraphPart.cpp.
References EdgeGraphPart(), and _clearEdges_().
|
private |
when the EdgeGraphPart contains no edge adjacent to a given node, this function adds an empty set entry to neighbours[id]
| id | the node whose neighbours[id] is checked |
Definition at line 68 of file edgeGraphPart_inl.h.
References _neighbours_.
Referenced by addEdge().
|
private |
Definition at line 93 of file edgeGraphPart.cpp.
References _edges_, _neighbours_, GUM_EMIT2, and onEdgeDeleted.
Referenced by ~EdgeGraphPart(), and clearEdges().
insert a new edge into the EdgeGraphPart
| n1 | the id of one extremity of the new edge to be inserted |
| n2 | the id of the other extremity of the new edge to be inserted |
Reimplemented in gum::CliqueGraph, gum::PAG, gum::PDAG, and gum::UndiGraph.
Definition at line 72 of file edgeGraphPart_inl.h.
References _checkNeighbours_(), _edges_, _neighbours_, GUM_EMIT2, and onEdgeAdded.
Referenced by gum::PDAG::addEdge(), and gum::UndiGraph::addEdge().
|
virtual |
removes all the edges from the EdgeGraphPart
Reimplemented in gum::CliqueGraph, and gum::PAG.
Definition at line 91 of file edgeGraphPart.cpp.
References _clearEdges_().
Referenced by gum::MixedGraph::clear(), gum::UndiGraph::clear(), gum::PAG::clearEdges(), operator=(), operator=(), and gum::MixedGraph::operator=().
| INLINE const EdgeSet & gum::EdgeGraphPart::edges | ( | ) | const |
returns the set of edges stored within the EdgeGraphPart
Definition at line 60 of file edgeGraphPart_inl.h.
References _edges_.
Referenced by gum::EssentialGraph::_buildEssentialGraph_(), gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::BarrenNodesFinder::barrenNodes(), gum::learning::ConstraintBasedLearning::initGraph_(), gum::learning::FCI::learnPAG(), gum::learning::FCI::possibleDSepPhase_(), gum::learning::SimpleMiic::propagatesOrientationInChainOfRemainingEdges_(), gum::PAG::reorientAllWith(), gum::learning::IBNLearner::setPossibleSkeleton(), gum::PAG::toDot(), gum::PAG::toMixedGraph(), and gum::PAG::toString().
| EdgeProperty< VAL > gum::EdgeGraphPart::edgesProperty | ( | const VAL & | val, |
| Size | size = 0 ) const |
a method to create a hashMap of VAL from a set of edges (using for every edge, say x, the VAL a)
| a | the default value assigned to each edge 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 edges. If you do not specify this parameter, the method will assign it for you. |
| EdgeProperty< VAL > gum::EdgeGraphPart::edgesProperty | ( | VAL(* | f )(const Edge &), |
| Size | size = 0 ) const |
a method to create a hashMap of VAL from a set of edges (using for every edge, say x, the VAL f(x))
| f | a function assigning a VAL to any edge |
| 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 edges. If you do not specify this parameter, the method will assign it for you. |
| INLINE bool gum::EdgeGraphPart::emptyEdges | ( | ) | const |
indicates wether the EdgeGraphPart contains any edge
Definition at line 56 of file edgeGraphPart_inl.h.
References _edges_.
|
virtual |
removes an edge from the EdgeGraphPart
| edge | the edge to be removed |
Reimplemented in gum::CliqueGraph, and gum::PAG.
Definition at line 83 of file edgeGraphPart_inl.h.
References _edges_, _neighbours_, existsEdge(), gum::Edge::first(), GUM_EMIT2, onEdgeDeleted, and gum::Edge::second().
Referenced by gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::PAG::eraseEdge(), eraseNeighbours(), gum::learning::SimpleMiic::learnPDAG(), gum::learning::SimpleMiic::learnStructure(), gum::learning::SimpleMiic::propagatesOrientationInChainOfRemainingEdges_(), and unvirtualizedEraseNeighbours().
| INLINE void gum::EdgeGraphPart::eraseNeighbours | ( | NodeId | id | ) |
erase all the edges adjacent to a given node
| id | the node the adjacent edges of which will be removed |
Definition at line 102 of file edgeGraphPart_inl.h.
References _neighbours_, gum::Set< Key >::beginSafe(), gum::Set< Key >::endSafe(), and eraseEdge().
indicates whether a given edge exists
| edge | the edge we test whether or not it belongs to the EdgeGraphPart |
Definition at line 62 of file edgeGraphPart_inl.h.
References _edges_.
Referenced by gum::prm::GSpan< GUM_SCALAR >::_sortPatterns_(), gum::EssentialGraph::_strongly_protected_(), gum::StaticTriangulation::_triangulate_(), gum::PAG::addEdge(), gum::learning::FCI::computePossibleDSep_(), eraseEdge(), gum::PAG::eraseEdge(), gum::Separation::isForwardSeparated(), gum::learning::FCI::learnPAG(), gum::learning::FCI::orientCollidersOnPAG_(), gum::learning::FCI::possibleDSepPhase_(), gum::learning::FCI::ruleR10_(), gum::learning::FCI::ruleR1_(), gum::learning::FCI::ruleR2_(), gum::learning::FCI::ruleR3_(), gum::learning::FCI::ruleR4_(), gum::learning::FCI::ruleR5_(), gum::learning::FCI::ruleR7_(), gum::learning::FCI::ruleR8_(), and gum::learning::FCI::ruleR9_().
indicates whether a given edge exists
| n1 | the id of one extremity of the edge we test the existence in the EdgeGraphPart |
| n2 | the id of the other extremity of the edge we test the existence in the EdgeGraphPart |
Definition at line 64 of file edgeGraphPart_inl.h.
References _neighbours_.
| List< VAL > gum::EdgeGraphPart::listMapEdges | ( | VAL(* | f )(const Edge &) | ) | const |
a method to create a list of VAL from a set of edges (using for every edge, say x, the VAL f(x))
| f | a function assigning a VAL to any edge |
returns the set of node neighbours to a given node
Note that the set of nodes returned may be empty if no edge within the EdgeGraphPart is adjacent the given node.
| id | the node to which the edges are adjacent |
Definition at line 97 of file edgeGraphPart_inl.h.
References _neighbours_, and gum::emptyNodeSet.
Referenced by gum::BinaryJoinTreeConverterDefault::_convertClique_(), gum::BinaryJoinTreeConverterDefault::_convertConnectedComponent_(), gum::BinaryJoinTreeConverterDefault::_markConnectedComponent_(), gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::prm::StructuredInference< GUM_SCALAR >::_removeBarrenNodes_(), gum::prm::GSpan< GUM_SCALAR >::_sortPatterns_(), gum::prm::GSpan< GUM_SCALAR >::_subgraph_mining_(), gum::StaticTriangulation::_triangulate_(), gum::learning::FCI::computePossibleDSep_(), gum::PAG::eraseNode(), gum::PDAG::hasMixedReallyOrientedPath(), gum::learning::SimpleMiic::learnPDAG(), gum::learning::SimpleMiic::learnStructure(), gum::UndiGraph::partialUndiGraph(), gum::learning::SimpleMiic::propagatesOrientationInChainOfRemainingEdges_(), gum::rec_hasMixedReallyOrientedPath(), gum::learning::FCI::ruleR10_(), gum::learning::FCI::ruleR1_(), gum::learning::FCI::ruleR2_(), gum::learning::FCI::ruleR3_(), gum::learning::FCI::ruleR4_(), gum::learning::FCI::ruleR5_(), gum::learning::FCI::ruleR6_(), gum::learning::FCI::ruleR7_(), gum::learning::FCI::ruleR8_(), gum::learning::FCI::ruleR9_(), gum::MixedGraph::toDot(), gum::PDAG::toDot(), and gum::UndiGraph::toDot().
| EdgeGraphPart & gum::EdgeGraphPart::operator= | ( | const EdgeGraphPart & | s | ) |
copy operator
| s | the EdgeGraphPart to copy |
Definition at line 110 of file edgeGraphPart.cpp.
References EdgeGraphPart(), _edges_, _neighbours_, clearEdges(), GUM_EMIT2, and onEdgeAdded.
Referenced by gum::MixedGraph::operator=(), gum::MixedGraph::operator=(), gum::UndiGraph::operator=(), and gum::UndiGraph::operator=().
| EdgeGraphPart & gum::EdgeGraphPart::operator= | ( | EdgeGraphPart && | s | ) |
move assignment operator
Definition at line 135 of file edgeGraphPart.cpp.
References EdgeGraphPart(), _edges_, _neighbours_, clearEdges(), GUM_EMIT2, and onEdgeAdded.
| INLINE bool gum::EdgeGraphPart::operator== | ( | const EdgeGraphPart & | p | ) | const |
tests whether two EdgeGraphParts contain the same edges
| p | the EdgeGraphPart that we compare with this |
Definition at line 126 of file edgeGraphPart_inl.h.
References EdgeGraphPart(), and _edges_.
Referenced by gum::MixedGraph::operator==(), and gum::UndiGraph::operator==().
| INLINE Size gum::EdgeGraphPart::sizeEdges | ( | ) | const |
indicates the number of edges stored within the EdgeGraphPart
Definition at line 58 of file edgeGraphPart_inl.h.
References _edges_.
|
virtual |
to friendly display the content of the EdgeGraphPart
Reimplemented in gum::CliqueGraph, gum::MixedGraph, gum::PAG, and gum::UndiGraph.
Definition at line 150 of file edgeGraphPart.cpp.
References _edges_.
Referenced by gum::operator<<(), gum::MixedGraph::toString(), and gum::UndiGraph::toString().
| INLINE void gum::EdgeGraphPart::unvirtualizedEraseNeighbours | ( | NodeId | id | ) |
same function as eraseNeighbours but without any virtual call to an erase
| id | the node whose ingoing arcs will be removed |
Definition at line 115 of file edgeGraphPart_inl.h.
References _neighbours_, gum::Set< Key >::beginSafe(), gum::Set< Key >::endSafe(), and eraseEdge().
Referenced by gum::MixedGraph::eraseNode(), and gum::UndiGraph::eraseNode().
|
private |
the set of all the edges contained within the EdgeGraphPart
Definition at line 238 of file edgeGraphPart.h.
Referenced by EdgeGraphPart(), EdgeGraphPart(), EdgeGraphPart(), _clearEdges_(), addEdge(), edges(), emptyEdges(), eraseEdge(), existsEdge(), operator=(), operator=(), operator==(), sizeEdges(), and toString().
|
private |
for each node, the set of its adjacent edges
Definition at line 241 of file edgeGraphPart.h.
Referenced by EdgeGraphPart(), EdgeGraphPart(), _checkNeighbours_(), _clearEdges_(), addEdge(), eraseEdge(), eraseNeighbours(), existsEdge(), neighbours(), operator=(), operator=(), and unvirtualizedEraseNeighbours().
Definition at line 98 of file edgeGraphPart.h.
Referenced by EdgeGraphPart(), addEdge(), operator=(), and operator=().
Definition at line 99 of file edgeGraphPart.h.
Referenced by _clearEdges_(), and eraseEdge().