![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Partial Ancestral Graph: undirected topology with endpoint marks. More...
#include <PAG.h>
Public Types | |
| using | EdgeIterator = EdgeSetIterator |
| using | NodeIterator = NodeGraphPartIterator |
| using | NodeConstIterator = NodeGraphPartIterator |
| using | NodeIteratorSafe = NodeGraphPartIteratorSafe |
| using | NodeConstIteratorSafe = NodeGraphPartIteratorSafe |
| using | node_iterator = NodeGraphPartIterator |
| types for STL compliance | |
| using | node_const_iterator = NodeGraphPartIterator |
| types for STL compliance | |
| using | node_iterator_safe = NodeGraphPartIteratorSafe |
| types for STL compliance | |
| using | node_const_iterator_safe = NodeGraphPartIteratorSafe |
| types for STL compliance | |
Public Member Functions | |
Constructors / Destructors | |
| PAG () | |
| PAG (const PAG &) | |
| PAG (PAG &&) noexcept | |
| ~PAG () override | |
| PAG & | operator= (const PAG &) |
| PAG & | operator= (PAG &&) noexcept |
Edge operations (override UndiGraph/EdgeGraphPart virtuals) | |
| void | addEdge (NodeId x, NodeId y) override |
| add edge with Circle-Circle marks | |
| void | addEdge (NodeId x, NodeId y, EdgeMark markAtX, EdgeMark markAtY) |
| add edge with explicit endpoint marks | |
| void | eraseEdge (const Edge &e) override |
| remove edge and its two mark entries | |
| void | clearEdges () override |
| clear all edges (and their marks) | |
| void | eraseNode (NodeId id) override |
| remove node and clean up marks for all its adjacent edges | |
| void | clear () override |
| remove all nodes, edges, and marks | |
Mark accessors | |
| EdgeMark | markAt (NodeId src, NodeId dst) const |
| mark at dst-endpoint when traversing from src | |
| void | setMarkAt (NodeId src, NodeId dst, EdgeMark m) |
| set mark at dst-endpoint when traversing from src | |
Endpoint-mark predicates | |
| bool | isArrowhead (NodeId src, NodeId dst) const |
| true if mark at dst (from src) is Arrowhead | |
| bool | isTail (NodeId src, NodeId dst) const |
| true if mark at dst (from src) is Tail | |
| bool | isCircle (NodeId src, NodeId dst) const |
| true if mark at dst (from src) is Circle | |
| bool | isDefinitelyDirected (NodeId x, NodeId y) const |
| true if edge x-y is definitely directed x→y (Tail@x, Arrowhead@y) | |
| bool | isBidirected (NodeId x, NodeId y) const |
| true if edge x-y is bidirected x↔y (Arrowhead on both endpoints) | |
| bool | isDefCollider (NodeId x, NodeId z, NodeId y) const |
| true if z is a definite collider on path x-z-y (Arrowhead at z from both sides) | |
Bulk operations | |
| void | reorientAllWith (EdgeMark m) |
| set all endpoint marks to m (used between FCI phases to reset to Circle) | |
Conversion / display | |
| MixedGraph | toMixedGraph () const |
| approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge | |
| std::string | toString () const override |
| approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge | |
| std::string | toDot () const override |
| approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge | |
Operators | |
| bool | operator== (const UndiGraph &g) const |
| tests whether two UndiGraphs are identical (same nodes, same edges) | |
Operators | |
| bool | operator== (const EdgeGraphPart &p) const |
| tests whether two EdgeGraphParts contain the same edges | |
Accessors/Modifiers | |
| bool | hasUndirectedCycle () const |
| checks whether the graph contains cycles | |
| virtual UndiGraph | partialUndiGraph (NodeSet nodes) |
| returns the partial graph formed by the nodes given in parameter | |
| NodeProperty< NodeId > | chainComponents () const |
| returns a property {node:id of chain component} (edges only) | |
| NodeProperty< NodeId > | connectedComponents () const |
| returns a property {node:id of weakly connected component} | |
| std::optional< std::vector< NodeId > > | undirectedPath (NodeId node1, NodeId node2) const |
| returns a shortest undirected path from node1 to node2, or std::nullopt if none | |
| bool | hasUndirectedPath (NodeId n1, NodeId n2) const |
| returns true if n1 and n2 are connected by an undirected path | |
| bool | hasUndirectedPath (NodeId n1, NodeId n2, const NodeSet &except) const |
| returns true if n1 and n2 are connected by a path avoiding nodes in except | |
| bool | hasUndirectedPath (const NodeSet &n1, const NodeSet &n2, const NodeSet &except) const |
| returns true if any node in n1 reaches any node in n2 avoiding except | |
Accessors/Modifiers | |
| 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 | |
| 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 | |
| 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)) | |
Operators | |
| bool | operator== (const NodeGraphPart &p) const |
| check whether two NodeGraphParts contain the same nodes | |
Accessors/Modifiers | |
| void | populateNodes (const NodeGraphPart &s) |
| populateNodes clears *this and fills it with the same nodes as "s" | |
| template<typename T> | |
| void | populateNodesFromProperty (const NodeProperty< T > &h) |
| populateNodesFromProperty clears *this and fills it with the keys of "h" | |
| NodeId | nextNodeId () const |
| returns a new node id, not yet used by any node | |
| virtual NodeId | addNode () |
| insert a new node and return its id | |
| std::vector< NodeId > | addNodes (Size n) |
| insert n nodes | |
| virtual void | addNodeWithId (const NodeId id) |
| try to insert a node with the given id | |
| bool | existsNode (const NodeId id) const |
| returns true iff the NodeGraphPart contains the given nodeId | |
| bool | exists (const NodeId id) const |
| alias for existsNode | |
| bool | emptyNodes () const |
| indicates whether there exists nodes in the NodeGraphPart | |
| bool | empty () const |
| alias for emptyNodes | |
| virtual void | clearNodes () |
| remove all the nodes from the NodeGraphPart | |
| Size | sizeNodes () const |
| returns the number of nodes in the NodeGraphPart | |
| Size | size () const |
| alias for sizeNodes | |
| NodeId | bound () const |
| returns a number n such that all node ids are strictly lower than n | |
| NodeSet | asNodeSet () const |
| returns a copy of the set of nodes represented by the NodeGraphPart | |
| const NodeGraphPart & | nodes () const |
| return *this as a NodeGraphPart | |
| node_iterator_safe | beginSafe () const |
| a begin iterator to parse the set of nodes contained in the NodeGraphPart | |
| const node_iterator_safe & | endSafe () const noexcept |
| the end iterator to parse the set of nodes contained in the NodeGraphPart | |
| node_iterator | begin () const noexcept |
| a begin iterator to parse the set of nodes contained in the NodeGraphPart | |
| const node_iterator & | end () const noexcept |
| the end iterator to parse the set of nodes contained in the NodeGraphPart | |
| std::string | nameFromId (NodeId id) const |
| returns the name of node id, or "<id>" if no name is set | |
| std::optional< NodeId > | idFromName (const std::string &name) const |
| returns the id of the node with the given name, or std::nullopt | |
| void | setName (NodeId id, const std::string &name) |
| sets the name of node id | |
| bool | hasName (NodeId id) const |
| returns true iff node id has an explicit name | |
| std::string | dotNodeLabel (NodeId id) const |
| returns " [label=\"...\"]" with DOT-escaped name, or "" if no name | |
| template<typename VAL> | |
| NodeProperty< VAL > | nodesPropertyFromFunction (VAL(*f)(const NodeId &), Size size=0) const |
| a method to create a HashTable with key:NodeId and value:VAL | |
| template<typename VAL> | |
| NodeProperty< VAL > | nodesPropertyFromVal (const VAL &a, Size size=0) const |
| a method to create a hashMap with key:NodeId and value:VAL | |
| template<typename VAL> | |
| List< VAL > | listMapNodes (VAL(*f)(const NodeId &)) const |
| a method to create a list of VAL from a set of nodes (using for every nodee, say x, the VAL f(x)) | |
Static Public Member Functions | |
Constructors / Destructors | |
| static UndiGraph | completeGraph (int n) |
| create a complete UndiGraph with n nodes | |
Public Attributes | |
| Signaler< NodeId, NodeId > | onEdgeAdded |
| Signaler< NodeId, NodeId > | onEdgeDeleted |
| Signaler< NodeId > | onNodeAdded |
| Signaler< NodeId > | onNodeDeleted |
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 | |
| ArcProperty< EdgeMark > | marks_ |
| marks_[Arc(x,y)] = mark at y-endpoint of edge x-y | |
| EdgeSet | _edges_ |
| the set of all the edges contained within the EdgeGraphPart | |
| NodeProperty< NodeSet * > | _neighbours_ |
| for each node, the set of its adjacent edges | |
Partial Ancestral Graph: undirected topology with endpoint marks.
Extends UndiGraph: the edge topology is stored in the base class; each edge carries two EdgeMark values (one per endpoint) stored in marks_.
marks_[Arc(x,y)] = mark at the y-endpoint of edge x-y.
Edge types represented:
|
inherited |
Definition at line 96 of file edgeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 268 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 270 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 267 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 269 of file nodeGraphPart.h.
|
inherited |
Definition at line 277 of file nodeGraphPart.h.
|
inherited |
Definition at line 279 of file nodeGraphPart.h.
|
inherited |
Definition at line 276 of file nodeGraphPart.h.
|
inherited |
Definition at line 278 of file nodeGraphPart.h.
| gum::PAG::PAG | ( | ) |
Definition at line 57 of file PAG.cpp.
References PAG().
Referenced by PAG(), PAG(), PAG(), ~PAG(), operator=(), and operator=().
| gum::PAG::PAG | ( | const PAG & | other | ) |
Definition at line 59 of file PAG.cpp.
References PAG(), gum::UndiGraph::UndiGraph(), and marks_.
|
noexcept |
|
override |
|
privateinherited |
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().
|
privateinherited |
Definition at line 93 of file edgeGraphPart.cpp.
References _edges_, _neighbours_, GUM_EMIT2, and onEdgeDeleted.
Referenced by ~EdgeGraphPart(), and clearEdges().
add edge with Circle-Circle marks
Reimplemented from gum::EdgeGraphPart.
Definition at line 91 of file PAG.cpp.
References addEdge(), and gum::Circle.
Referenced by addEdge(), and gum::learning::FCI::learnPAG().
add edge with explicit endpoint marks
Definition at line 93 of file PAG.cpp.
References gum::UndiGraph::addEdge(), gum::EdgeGraphPart::existsEdge(), and marks_.
|
virtualinherited |
insert a new node and return its id
Reimplemented in gum::CliqueGraph.
Definition at line 269 of file nodeGraphPart_inl.h.
References _boundVal_, _eraseHole_(), _holes_, _updateEndIteratorSafe_(), GUM_EMIT1, and onNodeAdded.
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::_addChild_(), gum::prm::StructuredInference< GUM_SCALAR >::_addEdgesInReducedGraph_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_buildPatternGraph_(), gum::prm::StructuredInference< GUM_SCALAR >::_buildPatternGraph_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot(), and populateNodesFromProperty().
insert n nodes
| n | the number of nodes to add |
Definition at line 287 of file nodeGraphPart_inl.h.
Referenced by gum::DiGraph::completeGraph(), gum::UndiGraph::completeGraph(), and populateNodesFromProperty().
|
virtualinherited |
try to insert a node with the given id
| DuplicateElement | exception if the id already exists |
Reimplemented in gum::CliqueGraph.
Definition at line 214 of file nodeGraphPart.cpp.
References _boundVal_, _eraseHole_(), _holes_, _holes_resize_policy_, _holes_size_, _inHoles_(), _updateEndIteratorSafe_(), GUM_EMIT1, GUM_ERROR, and onNodeAdded.
Referenced by gum::EssentialGraph::_buildEssentialGraph_(), gum::prm::GSpan< GUM_SCALAR >::_sortPatterns_(), gum::prm::gspan::Pattern::addNodeWithLabel(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::Separation::isForwardSeparated(), gum::learning::IBNLearner::learnDag_(), gum::learning::FCI::learnPAG(), gum::learning::SimpleMiic::learnStructure(), gum::graph::markovBlanket(), gum::graph::moralGraph(), gum::graph::moralizedAncestralGraph(), gum::UndiGraph::partialUndiGraph(), populateNodesFromProperty(), gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), gum::learning::IBNLearner::preparePC_(), gum::MeekRules::propagateToCPDAG(), gum::MeekRules::propagateToDAG(), gum::learning::StructuralConstraintDAG::setGraphAlone(), gum::EssentialGraph::skeleton(), and gum::PAG::toMixedGraph().
|
inherited |
returns a copy of the set of nodes represented by the NodeGraphPart
Definition at line 367 of file nodeGraphPart_inl.h.
References _boundVal_, _inHoles_(), empty(), gum::Set< Key >::insert(), and sizeNodes().
Referenced by gum::MarginalTargetedInference< GUM_SCALAR >::MarginalTargetedInference(), gum::MarginalTargetedMRFInference< GUM_SCALAR >::MarginalTargetedMRFInference(), gum::DoCalculus< GUM_SCALAR >::_ancestorsIn_(), populateNodesFromProperty(), and gum::ImportanceSampling< GUM_SCALAR >::unsharpenBN_().
|
noexceptinherited |
a begin iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 346 of file nodeGraphPart_inl.h.
References NodeGraphPartIterator, and gum::NodeGraphPartIterator::validate_().
Referenced by gum::Estimator< GUM_SCALAR >::Estimator(), gum::learning::ConstraintBasedLearning::initGraph_(), populateNodesFromProperty(), and gum::Estimator< GUM_SCALAR >::setFromBN().
|
inherited |
a begin iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 334 of file nodeGraphPart_inl.h.
References NodeGraphPartIteratorSafe, and gum::NodeGraphPartIterator::validate_().
Referenced by populateNodesFromProperty().
|
inherited |
returns a number n such that all node ids are strictly lower than n
Definition at line 323 of file nodeGraphPart_inl.h.
References _boundVal_.
Referenced by _clearNodes_(), and populateNodesFromProperty().
|
inherited |
returns a property {node:id of chain component} (edges only)
Definition at line 123 of file undiGraph_inl.h.
References gum::graph::chainComponents().
|
overridevirtual |
remove all nodes, edges, and marks
Reimplemented from gum::NodeGraphPart.
Definition at line 125 of file PAG.cpp.
References gum::UndiGraph::clear(), and marks_.
|
overridevirtual |
clear all edges (and their marks)
Reimplemented from gum::EdgeGraphPart.
Definition at line 108 of file PAG.cpp.
References gum::EdgeGraphPart::clearEdges(), and marks_.
|
virtualinherited |
remove all the nodes from the NodeGraphPart
Definition at line 325 of file nodeGraphPart_inl.h.
References _clearNodes_().
Referenced by gum::DiGraph::clear(), gum::MixedGraph::clear(), gum::UndiGraph::clear(), gum::MixedGraph::operator=(), operator=(), and populateNodesFromProperty().
|
staticinherited |
create a complete UndiGraph with n nodes
| n | int |
Definition at line 61 of file undiGraph.cpp.
References UndiGraph(), addEdge(), and gum::NodeGraphPart::addNodes().
|
inherited |
returns a property {node:id of weakly connected component}
Definition at line 127 of file undiGraph_inl.h.
References gum::graph::connectedComponents().
|
inherited |
returns " [label=\"...\"]" with DOT-escaped name, or "" if no name
Definition at line 188 of file nodeGraphPart.cpp.
References _names_, and hasName().
Referenced by populateNodesFromProperty(), gum::DiGraph::toDot(), gum::MixedGraph::toDot(), gum::PAG::toDot(), gum::PDAG::toDot(), and gum::UndiGraph::toDot().
|
inherited |
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().
|
inherited |
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. |
|
inherited |
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. |
|
inherited |
alias for emptyNodes
Definition at line 321 of file nodeGraphPart_inl.h.
References emptyNodes().
Referenced by asNodeSet(), populateNodesFromProperty(), gum::prm::gspan::Pattern::remove(), and gum::PDAG::toDot().
|
inherited |
indicates wether the EdgeGraphPart contains any edge
Definition at line 56 of file edgeGraphPart_inl.h.
References _edges_.
|
inherited |
indicates whether there exists nodes in the NodeGraphPart
Definition at line 319 of file nodeGraphPart_inl.h.
References sizeNodes().
Referenced by empty(), and populateNodesFromProperty().
|
noexceptinherited |
the end iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 352 of file nodeGraphPart_inl.h.
References _endIteratorSafe_, and NodeGraphPartIterator.
Referenced by gum::Estimator< GUM_SCALAR >::Estimator(), gum::learning::ConstraintBasedLearning::initGraph_(), populateNodesFromProperty(), and gum::Estimator< GUM_SCALAR >::setFromBN().
|
noexceptinherited |
the end iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 342 of file nodeGraphPart_inl.h.
References _endIteratorSafe_, and NodeGraphPartIteratorSafe.
Referenced by populateNodesFromProperty().
|
overridevirtual |
remove edge and its two mark entries
Reimplemented from gum::EdgeGraphPart.
Definition at line 101 of file PAG.cpp.
References gum::EdgeGraphPart::eraseEdge(), gum::EdgeGraphPart::existsEdge(), gum::Edge::first(), marks_, and gum::Edge::second().
Referenced by gum::learning::FCI::possibleDSepPhase_().
|
inherited |
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().
|
overridevirtual |
remove node and clean up marks for all its adjacent edges
Reimplemented from gum::NodeGraphPart.
Definition at line 113 of file PAG.cpp.
References gum::UndiGraph::eraseNode(), gum::NodeGraphPart::existsNode(), marks_, and gum::EdgeGraphPart::neighbours().
alias for existsNode
Definition at line 307 of file nodeGraphPart_inl.h.
References existsNode().
Referenced by gum::prm::StructuredInference< GUM_SCALAR >::_removeNode_(), gum::DiGraph::addArc(), gum::prm::gspan::Pattern::addArc(), gum::UndiGraph::addEdge(), gum::prm::gspan::Pattern::exists(), gum::learning::IBNLearner::learnDag_(), and populateNodesFromProperty().
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_.
returns true iff the NodeGraphPart contains the given nodeId
Definition at line 301 of file nodeGraphPart_inl.h.
References _boundVal_, and _inHoles_().
Referenced by eraseNode(), gum::PAG::eraseNode(), exists(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::Separation::isForwardSeparated(), gum::graph::markovBlanket(), gum::graph::moralizedAncestralGraph(), gum::UndiGraph::partialUndiGraph(), populateNodesFromProperty(), gum::Separation::reduceForDSeparation(), and setName().
returns true iff node id has an explicit name
Definition at line 186 of file nodeGraphPart.cpp.
References _names_.
Referenced by dotNodeLabel(), and populateNodesFromProperty().
|
inherited |
checks whether the graph contains cycles
Definition at line 131 of file undiGraph_inl.h.
References gum::graph::hasUndirectedCycle().
|
inherited |
returns true if any node in n1 reaches any node in n2 avoiding except
Definition at line 117 of file undiGraph_inl.h.
References gum::graph::hasUndirectedPath().
returns true if n1 and n2 are connected by an undirected path
Definition at line 109 of file undiGraph_inl.h.
References gum::graph::hasUndirectedPath().
|
inherited |
returns true if n1 and n2 are connected by a path avoiding nodes in except
n2 in except naturally leads to false
Definition at line 113 of file undiGraph_inl.h.
References gum::graph::hasUndirectedPath().
|
inherited |
returns the id of the node with the given name, or std::nullopt
Definition at line 165 of file nodeGraphPart.cpp.
References _names_.
Referenced by populateNodesFromProperty().
true if mark at dst (from src) is Arrowhead
Definition at line 142 of file PAG.cpp.
References gum::Arrowhead, and markAt().
Referenced by isBidirected(), isDefCollider(), isDefinitelyDirected(), gum::learning::FCI::ruleR10_(), gum::learning::FCI::ruleR1_(), gum::learning::FCI::ruleR2_(), gum::learning::FCI::ruleR3_(), gum::learning::FCI::ruleR4_(), gum::learning::FCI::ruleR8_(), gum::learning::FCI::ruleR9_(), toDot(), and toMixedGraph().
true if edge x-y is bidirected x↔y (Arrowhead on both endpoints)
Definition at line 155 of file PAG.cpp.
References isArrowhead().
Referenced by gum::learning::FCI::learnPAG().
true if mark at dst (from src) is Circle
Definition at line 148 of file PAG.cpp.
References gum::Circle, and markAt().
Referenced by 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_(), and toDot().
true if z is a definite collider on path x-z-y (Arrowhead at z from both sides)
Definition at line 159 of file PAG.cpp.
References isArrowhead().
Referenced by gum::learning::FCI::computePossibleDSep_().
true if edge x-y is definitely directed x→y (Tail@x, Arrowhead@y)
Definition at line 150 of file PAG.cpp.
References isArrowhead(), and isTail().
true if mark at dst (from src) is Tail
Definition at line 146 of file PAG.cpp.
References markAt(), and gum::Tail.
Referenced by isDefinitelyDirected(), gum::learning::FCI::ruleR10_(), gum::learning::FCI::ruleR1_(), gum::learning::FCI::ruleR2_(), gum::learning::FCI::ruleR4_(), gum::learning::FCI::ruleR6_(), gum::learning::FCI::ruleR7_(), and gum::learning::FCI::ruleR8_().
|
inherited |
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 |
|
inherited |
a method to create a list of VAL from a set of nodes (using for every nodee, say x, the VAL f(x))
| f | a function assigning a VAL to any node |
References listMapNodes().
Referenced by listMapNodes().
mark at dst-endpoint when traversing from src
Definition at line 134 of file PAG.cpp.
References marks_.
Referenced by isArrowhead(), isCircle(), isTail(), and toString().
|
inherited |
returns the name of node id, or "<id>" if no name is set
Definition at line 160 of file nodeGraphPart.cpp.
References _names_.
Referenced by populateNodesFromProperty().
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().
|
inherited |
returns a new node id, not yet used by any node
Definition at line 243 of file nodeGraphPart_inl.h.
References _boundVal_, and _holes_.
Referenced by populateNodesFromProperty().
|
inherited |
return *this as a NodeGraphPart
Definition at line 379 of file nodeGraphPart_inl.h.
References NodeGraphPart().
Referenced by gum::DoCalculus< GUM_SCALAR >::_ancestorsIn_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::ClassBayesNet< GUM_SCALAR >::_init_(), gum::prm::SVE< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVED< GUM_SCALAR >::_initElimOrder_(), gum::prm::SVE< GUM_SCALAR >::_initLiftedNodes_(), gum::MeekRules::_orientDoubleHeadedArcs_(), gum::prm::GSpan< GUM_SCALAR >::_sortPatterns_(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::DoorCriteria::enumerateBackdoorSets(), gum::learning::ConstraintBasedLearning::initGraph_(), gum::learning::FCI::learnPAG(), gum::DAG::moralizedAncestralGraph(), gum::graph::moralizedAncestralGraph(), gum::PDAG::moralizedAncestralGraph(), gum::prm::gspan::Pattern::nodes(), operator<<(), gum::learning::ConstraintBasedLearning::orientDoubleHeadedArcs_(), gum::UndiGraph::partialUndiGraph(), populateNodesFromProperty(), gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), gum::learning::IBNLearner::preparePC_(), 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::DiGraph::toDot(), gum::MixedGraph::toDot(), gum::PAG::toDot(), gum::PDAG::toDot(), gum::UndiGraph::toDot(), and gum::PAG::toMixedGraph().
|
inherited |
a method to create a HashTable with key:NodeId and value:VAL
VAL are computed from the nodes using for all node x, VAL f(x). This method is a wrapper of the same method in HashTable.
| f | a function assigning a VAL to any node |
| 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 nodes. If you do not specify this parameter, the method will assign it for you. |
References nodesPropertyFromFunction(), and size().
Referenced by nodesPropertyFromFunction().
|
inherited |
a method to create a hashMap with key:NodeId and value:VAL
for all nodes, the value stored is a. This method is a wrapper of the same method in HashTable.
| 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 nodes. If you do not specify this parameter, the method will assign it for you. |
References nodesPropertyFromVal(), and size().
Referenced by gum::BinaryJoinTreeConverterDefault::convert(), and nodesPropertyFromVal().
Definition at line 71 of file PAG.cpp.
References PAG(), marks_, and gum::UndiGraph::operator=().
Definition at line 79 of file PAG.cpp.
References PAG(), marks_, and gum::UndiGraph::operator=().
|
inherited |
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==().
|
inherited |
check whether two NodeGraphParts contain the same nodes
| p | the NodeGraphPart to be compared with "this" |
Definition at line 356 of file nodeGraphPart_inl.h.
References NodeGraphPart(), _boundVal_, and _holes_.
Referenced by gum::DiGraph::operator==(), gum::MixedGraph::operator==(), and gum::UndiGraph::operator==().
tests whether two UndiGraphs are identical (same nodes, same edges)
| g | the UndiGraph with which "this" is compared |
Definition at line 100 of file undiGraph_inl.h.
References UndiGraph(), gum::EdgeGraphPart::operator==(), and gum::NodeGraphPart::operator==().
returns the partial graph formed by the nodes given in parameter
Definition at line 127 of file undiGraph.cpp.
References UndiGraph(), addEdge(), gum::NodeGraphPart::addNodeWithId(), gum::NodeGraphPart::existsNode(), gum::EdgeGraphPart::neighbours(), and gum::NodeGraphPart::nodes().
|
inherited |
populateNodes clears *this and fills it with the same nodes as "s"
populateNodes should basically be the preferred way to insert nodes with IDs not selected by the internal idFactory.
| s | the NodeGraphPart to be copied |
Definition at line 97 of file nodeGraphPart.cpp.
References NodeGraphPart(), _boundVal_, _cloneNames_(), _holes_, _holes_resize_policy_, _holes_size_, _names_, _updateEndIteratorSafe_(), and clear().
Referenced by operator=().
|
inherited |
populateNodesFromProperty clears *this and fills it with the keys of "h"
populateNodes should basically be the preferred way to insert nodes with IDs not selected by the internal idFactory.
References NodeGraphPart(), addNode(), addNodes(), addNodeWithId(), asNodeSet(), begin(), beginSafe(), bound(), clear(), clearNodes(), dotNodeLabel(), empty(), emptyNodes(), end(), endSafe(), eraseNode(), exists(), existsNode(), hasName(), idFromName(), nameFromId(), nextNodeId(), nodes(), setName(), size(), sizeNodes(), and toString().
| void gum::PAG::reorientAllWith | ( | EdgeMark | m | ) |
set all endpoint marks to m (used between FCI phases to reset to Circle)
Definition at line 168 of file PAG.cpp.
References gum::EdgeGraphPart::edges(), and setMarkAt().
Referenced by gum::learning::FCI::learnPAG().
set mark at dst-endpoint when traversing from src
Definition at line 136 of file PAG.cpp.
References marks_.
Referenced by gum::learning::FCI::doDdpOrientation_(), gum::learning::FCI::learnPAG(), gum::learning::FCI::orientCollidersOnPAG_(), reorientAllWith(), gum::learning::FCI::ruleR10_(), gum::learning::FCI::ruleR1_(), gum::learning::FCI::ruleR2_(), gum::learning::FCI::ruleR3_(), gum::learning::FCI::ruleR5_(), gum::learning::FCI::ruleR6_(), gum::learning::FCI::ruleR7_(), gum::learning::FCI::ruleR8_(), and gum::learning::FCI::ruleR9_().
|
inherited |
sets the name of node id
| DuplicateElement | if name is already used by another node |
Definition at line 170 of file nodeGraphPart.cpp.
References _names_, existsNode(), and GUM_ERROR.
Referenced by gum::GraphicalModel::_nameNodes_(), gum::CausalModel< GUM_SCALAR >::causalDAG(), populateNodesFromProperty(), and gum::EssentialGraph::skeleton().
|
inherited |
alias for sizeNodes
Definition at line 299 of file nodeGraphPart_inl.h.
References sizeNodes().
Referenced by gum::StaticTriangulation::StaticTriangulation(), gum::prm::gspan::DFSTree< GUM_SCALAR >::_addChild_(), gum::StaticTriangulation::_triangulate_(), nodesPropertyFromFunction(), nodesPropertyFromVal(), populateNodesFromProperty(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::dSeparationAlgorithm::requisiteNodes(), gum::prm::gspan::Pattern::size(), and gum::UndiGraph::toDot().
|
inherited |
indicates the number of edges stored within the EdgeGraphPart
Definition at line 58 of file edgeGraphPart_inl.h.
References _edges_.
|
inherited |
returns the number of nodes in the NodeGraphPart
Definition at line 295 of file nodeGraphPart_inl.h.
References _boundVal_, and _holes_.
Referenced by gum::BinaryJoinTreeConverterDefault::_markConnectedComponent_(), asNodeSet(), gum::BinaryJoinTreeConverterDefault::convert(), emptyNodes(), populateNodesFromProperty(), and size().
|
overridevirtual |
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge
Reimplemented from gum::UndiGraph.
Definition at line 230 of file PAG.cpp.
References gum::NodeGraphPart::dotNodeLabel(), gum::EdgeGraphPart::edges(), isArrowhead(), isCircle(), and gum::NodeGraphPart::nodes().
| MixedGraph gum::PAG::toMixedGraph | ( | ) | const |
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge
Definition at line 179 of file PAG.cpp.
References gum::DiGraph::addArc(), gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), gum::EdgeGraphPart::edges(), isArrowhead(), and gum::NodeGraphPart::nodes().
Referenced by gum::learning::FCI::learnMixedStructure(), and gum::learning::FCI::learnPAG().
|
overridevirtual |
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; anything else → undirected edge
Reimplemented from gum::NodeGraphPart.
Definition at line 215 of file PAG.cpp.
References gum::EdgeGraphPart::edges(), markAt(), and gum::NodeGraphPart::toString().
Referenced by gum::operator<<().
|
inherited |
returns a shortest undirected path from node1 to node2, or std::nullopt if none
Definition at line 104 of file undiGraph_inl.h.
References gum::graph::undirectedPath().
|
inherited |
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().
|
privateinherited |
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().
|
privateinherited |
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().
|
private |
marks_[Arc(x,y)] = mark at y-endpoint of edge x-y
Definition at line 197 of file PAG.h.
Referenced by PAG(), PAG(), addEdge(), clear(), clearEdges(), eraseEdge(), eraseNode(), markAt(), operator=(), operator=(), and setMarkAt().
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().
Definition at line 281 of file nodeGraphPart.h.
Referenced by addNode(), and addNodeWithId().
Definition at line 282 of file nodeGraphPart.h.
Referenced by _clearNodes_(), and eraseNode().