![]() |
aGrUM 3.2.0
a C++ library for (probabilistic) graphical models
|
A DFSTree is used by gspan to sort lexicographically patterns discovered in an interface graph. More...
#include <agrum/PRM/gspan/DFSTree.h>
Classes | |
| struct | PatternData |
| class | NeighborDegreeSort |
| This is used to generate the max_indep_set of a Pattern. More... | |
Public Member Functions | |
Constructor and destructor. | |
| DFSTree (const InterfaceGraph< GUM_SCALAR > &graph, SearchStrategy< GUM_SCALAR > *strategy=0) | |
| Default constructor. | |
| ~DFSTree () override | |
| Destructor. | |
DFSTree getters and setters. | |
| const InterfaceGraph< GUM_SCALAR > & | internalGraph () const |
| Returns the list of root patterns in this DFSTree. | |
| std::list< NodeId > & | roots () |
| Returns the list of root patterns in this DFSTree. | |
| const std::list< NodeId > & | roots () const |
| Returns the list of root patterns in this DFSTree. | |
| Pattern & | parent (const Pattern &p) |
| Returns the parent of p in this DFSTree. | |
| const Pattern & | parent (const Pattern &p) const |
| Returns the parent of p in this DFSTree. | |
| std::list< NodeId > & | children (const Pattern &p) |
| Returns the list of p children in this DFSTree. | |
| const std::list< NodeId > & | children (const Pattern &p) const |
| Returns the list of p children in this DFSTree. | |
| Pattern & | pattern (NodeId id) |
| Returns the pattern represented by id in this DFSTree. | |
| const Pattern & | pattern (NodeId id) const |
| Returns the pattern represented by id in this DFSTree. | |
| void | addRoot (LabelData &data) |
| Add a one edge Pattern in this DFSTree. | |
| Pattern & | growPattern (Pattern &p, EdgeGrowth< GUM_SCALAR > &edge_growth, Size min_freq) |
| Add a one edge growth of p as one of its child. | |
Isomorphisms for patterns in this DFSTree. | |
| UndiGraph & | iso_graph (const Pattern &p) |
| Returns the isomorphism graph of p in the interface graph. | |
| Sequence< PRMInstance< GUM_SCALAR > * > & | iso_map (const Pattern &p, NodeId node) |
| Given a pattern and a node in its isomorphism graph, this methods returns the sequence of instance matching p in the interface graph. | |
| Set< NodeId > & | max_indep_set (const Pattern &p) |
| Returns the maximal independent set of p isomorphism graph. | |
| double | frequency (const Pattern &p) const |
| Returns the frequency of p respecting it's maximal independent set. | |
| PatternData & | data (const Pattern &p) |
| const PatternData & | data (const Pattern &p) const |
| SearchStrategy< GUM_SCALAR > & | strategy () |
| strategy getter | |
| const SearchStrategy< GUM_SCALAR > & | strategy () const |
| strategy getter | |
Private Types | |
| using | ArcIterator = ArcSetIterator |
| 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 | |
Private Member Functions | |||
| void | _checkGrowth_ (Pattern &p, Pattern *child, EdgeGrowth< GUM_SCALAR > &edge_growth) | ||
| Raise different exceptions if child is invalid or illegal. | |||
| void | _addChild_ (Pattern &p, Pattern *child, EdgeGrowth< GUM_SCALAR > &edge_growth) | ||
| Add a child to this DFSTree. | |||
| bool | _is_new_seq_ (Sequence< PRMInstance< GUM_SCALAR > * > &seq, NodeProperty< Sequence< PRMInstance< GUM_SCALAR > * > * > &iso_map) | ||
| Check if an instance match is redundant. | |||
| void | _initialiaze_root_ (Pattern *p, Sequence< EdgeData< GUM_SCALAR > * > &seq) | ||
| This initialize the DSFTree with a new root. | |||
| bool | _test_equality_ (HashTable< PRMClassElement< GUM_SCALAR > *, Size > &x, HashTable< PRMClassElement< GUM_SCALAR > *, Size > &y) | ||
| bool | hasDirectedPath (NodeId from, NodeId to) const | ||
| checks whether there exists a directed path from from to to | |||
| std::optional< std::vector< NodeId > > | directedPath (NodeId node1, NodeId node2) const | ||
| returns a directed path from node1 to node2, or std::nullopt if none | |||
| std::optional< std::vector< NodeId > > | directedUnorientedPath (NodeId node1, NodeId node2) const | ||
| returns a shortest path from node1 to node2 ignoring arc orientation, or std::nullopt if none | |||
| NodeSet | ancestors (NodeId id) const | ||
| returns the set of all ancestors of id (nodes from which id is reachable) | |||
| NodeSet | descendants (NodeId id) const | ||
| returns the set of all descendants of id (nodes reachable from id) | |||
| NodeSet | family (NodeId id) const | ||
| returns { id } ∪ parents(id) | |||
| NodeSet | family (const NodeSet &ids) const | ||
| returns the union of families of all nodes in ids | |||
| NodeProperty< NodeId > | connectedComponents () const | ||
| returns a property {node:id of weakly connected component} | |||
| 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 | |||
| 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] | |||
Operators | |||
| bool | operator== (const DiGraph &g) const | ||
| tests whether two DiGraphs are identical (same nodes, same arcs) | |||
Operators | |||
| bool | operator== (const ArcGraphPart &p) const | ||
| tests whether two ArcGraphParts contain the same arcs | |||
Accessors/Modifiers | |||
tests whether two DiGraphs are different
| |||
| void | addArc (const NodeId tail, const NodeId head) override | ||
| insert a new arc into the directed graph | |||
| void | eraseNode (const NodeId id) override | ||
| remove a node and its adjacent arcs from the graph | |||
| void | clear () override | ||
| removes all the nodes and arcs from the graph | |||
| std::string | toString () const override | ||
| to friendly display the content of the graph | |||
| virtual std::string | toDot () const | ||
| to friendly display the content of the graph in the DOT syntax | |||
| Sequence< NodeId > | topologicalOrder () const | ||
| Build and return a topological order. | |||
Accessors/Modifiers | |||
| 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 | parents (const NodeSet &ids) const | ||
| returns the set of parents of a set of nodes | |||
| 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 | |||
| 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 | |||
| 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)) | |||
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 Private Member Functions | |
Constructors / Destructors | |
| static DiGraph | completeGraph (int n) |
| Build a complete DiGraph with n nodes. | |
Private Attributes | |
| const InterfaceGraph< GUM_SCALAR > * | _graph_ |
| The interface graph on which this DFSTree applies. | |
| std::list< NodeId > | _roots_ |
| The list of root patterns in this DFSTree. | |
| Bijection< NodeId, Pattern * > | _node_map_ |
| The mapping between nodes in this DFSTree and the patterns they represents. | |
| HashTable< Pattern *, PatternData * > | _data_ |
| Data about patterns in this DFSTree. | |
| SearchStrategy< GUM_SCALAR > * | _strategy_ |
| The strategy used to prune the search tree. | |
| Signaler< NodeId, NodeId > | onArcAdded |
| Signaler< NodeId, NodeId > | onArcDeleted |
| 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 | |
| Signaler< NodeId > | onNodeAdded |
| Signaler< NodeId > | onNodeDeleted |
A DFSTree is used by gspan to sort lexicographically patterns discovered in an interface graph.
|
inherited |
Definition at line 100 of file arcGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 270 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 272 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 269 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 271 of file nodeGraphPart.h.
|
inherited |
Definition at line 279 of file nodeGraphPart.h.
|
inherited |
Definition at line 281 of file nodeGraphPart.h.
|
inherited |
Definition at line 278 of file nodeGraphPart.h.
|
inherited |
Definition at line 280 of file nodeGraphPart.h.
| gum::prm::gspan::DFSTree< GUM_SCALAR >::DFSTree | ( | const InterfaceGraph< GUM_SCALAR > & | graph, |
| gspan::SearchStrategy< GUM_SCALAR > * | strategy = 0 ) |
Default constructor.
Definition at line 384 of file DFSTree_tpl.h.
References DFSTree(), gum::prm::gspan::FrequenceSearch< GUM_SCALAR >::FrequenceSearch(), _graph_, _strategy_, and strategy().
Referenced by DFSTree(), and ~DFSTree().
|
override |
Destructor.
Definition at line 58 of file DFSTree_tpl.h.
References DFSTree(), _data_, and _strategy_.
|
private |
Add a child to this DFSTree.
Definition at line 181 of file DFSTree_tpl.h.
References _data_, _node_map_, gum::NodeGraphPart::addNode(), children(), gum::prm::gspan::Pattern::code(), pattern(), and gum::NodeGraphPart::size().
Referenced by growPattern().
|
privateinherited |
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 |
Raise different exceptions if child is invalid or illegal.
Definition at line 208 of file DFSTree_tpl.h.
References gum::prm::gspan::Pattern::addArc(), gum::prm::gspan::Pattern::addNodeWithLabel(), gum::prm::gspan::Pattern::code(), gum::prm::gspan::DFSCode::codes, gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::edge, gum::prm::gspan::Pattern::edgeCode(), GUM_ERROR, gum::prm::gspan::EdgeCode::isBackward(), gum::prm::gspan::Pattern::isMinimal(), gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::l_v, gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::u, and gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::v.
Referenced by growPattern().
|
privateinherited |
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().
|
private |
This initialize the DSFTree with a new root.
| p | A Pattern. |
| seq | A sequence of EdgeData<GUM_SCALAR>. |
Definition at line 114 of file DFSTree_tpl.h.
References _data_, gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNode(), data(), gum::SequenceImplementation< Key, Gen >::exists(), gum::Set< Key >::exists(), gum::SequenceImplementation< Key, Gen >::insert(), gum::Set< Key >::insert(), gum::prm::gspan::DFSTree< GUM_SCALAR >::PatternData::iso_graph, gum::prm::gspan::DFSTree< GUM_SCALAR >::PatternData::iso_map, gum::prm::gspan::DFSTree< GUM_SCALAR >::PatternData::max_indep_set, and gum::EdgeGraphPart::neighbours().
Referenced by addRoot().
|
private |
Check if an instance match is redundant.
Definition at line 162 of file DFSTree_tpl.h.
References iso_map().
Referenced by growPattern().
|
private |
insert a new arc into the directed graph
| tail | the id of the tail of the new inserted arc |
| head | the id of the head of the new inserted arc |
| InvalidNode | if head or tail does not belong to the graph nodes |
Reimplemented from gum::ArcGraphPart.
Reimplemented in gum::PDAG, and gum::prm::gspan::Pattern.
Definition at line 59 of file diGraph_inl.h.
References gum::ArcGraphPart::addArc(), gum::NodeGraphPart::exists(), and GUM_ERROR.
Referenced by gum::EssentialGraph::_buildEssentialGraph_(), gum::MeekRules::_propagatesOrientationInChainOfRemainingEdges_(), gum::DAG::addArc(), gum::DAGCycleDetector::addArc(), gum::PDAG::addArc(), gum::prm::gspan::Pattern::addArc(), completeGraph(), gum::learning::SimpleMiic::learnPDAG(), gum::learning::SimpleMiic::learnStructure(), gum::graph::moralizedAncestralGraph(), gum::learning::IBNLearner::prepareFCI_(), gum::learning::IBNLearner::prepareMiic_(), gum::learning::IBNLearner::preparePC_(), gum::learning::SimpleMiic::propagatesOrientationInChainOfRemainingEdges_(), gum::learning::StructuralConstraintDAG::setGraphAlone(), and gum::PAG::toMixedGraph().
|
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::Set< Key >::begin(), gum::Set< Key >::empty(), GUM_EMIT1, and onNodeAdded.
Referenced by gum::IncrementalGraphLearner< AttributeSelection, isScalar >::IncrementalGraphLearner(), gum::MultiDimFunctionGraph< GUM_ELEMENT, TerminalNodePolicy >::MultiDimFunctionGraph(), 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 >::_initialiaze_root_(), gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot(), populateNodesFromProperty(), and gum::LeafAggregator::update().
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, gum::Set< Key >::insert(), and onNodeAdded.
Referenced by gum::prm::StructuredInference< GUM_SCALAR >::CData::CData(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph(), gum::EssentialGraph::_buildEssentialGraph_(), gum::SpanningForestPrim::_computeInAComponent_(), 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::KTBNLearner< GUM_SCALAR >::learnParameters(), gum::learning::SimpleMiic::learnStructure(), gum::graph::markovBlanket(), 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(), gum::CausalModel< GUM_ELEMENT >::toDot(), and gum::PAG::toMixedGraph().
| void gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot | ( | LabelData & | data | ) |
Add a one edge Pattern in this DFSTree.
| data | Data over the edge used to create a root of this DFSTree. |
Definition at line 70 of file DFSTree_tpl.h.
References gum::prm::gspan::Pattern::Pattern(), _data_, _graph_, _initialiaze_root_(), _node_map_, _roots_, gum::prm::gspan::Pattern::addArc(), gum::NodeGraphPart::addNode(), gum::prm::gspan::Pattern::addNodeWithLabel(), data(), gum::HashTable< Key, Val >::insert(), roots(), and strategy().
returns the set of all ancestors of id (nodes from which id is reachable)
Definition at line 119 of file diGraph_inl.h.
References gum::graph::ancestors().
Referenced by gum::DAGmodel::ancestors(), gum::EssentialGraph::ancestors(), gum::MarkovBlanket::ancestors(), gum::Separation::isAncestorOf(), and gum::DoorCriteria::nodesOnDirectedPaths().
|
inherited |
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::learning::ConstraintBasedLearning::applyStructuralConstraints_(), gum::DAGmodel::arcs(), gum::EssentialGraph::arcs(), gum::MarkovBlanket::arcs(), gum::prm::gspan::Pattern::arcs(), gum::learning::FCI::learnPAG(), gum::learning::SimpleMiic::learnStructure(), gum::learning::Miic::orientationMiic_(), and gum::DiGraph::toDot().
|
inherited |
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. |
|
inherited |
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. |
|
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_(), gum::DoCalculus< GUM_SCALAR >::_cDecomposition_(), gum::DoCalculus< GUM_SCALAR >::_ID_(), gum::DoCalculus< GUM_SCALAR >::_topoObserved_(), 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_(), gum::StaticTriangulation::_computeEliminationTree_(), populateNodesFromProperty(), gum::NodeGraphPartIterator::validate_(), and gum::NodeGraphPartIteratorSafe::whenNodeDeleted().
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::DoCalculus< GUM_SCALAR >::_topoObserved_(), gum::BarrenNodesFinder::barrenNodes(), children(), gum::DAGmodel::children(), gum::DAGmodel::children(), gum::EssentialGraph::children(), gum::EssentialGraph::children(), gum::MarkovBlanket::children(), gum::MarkovBlanket::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::EssentialGraph::toDot(), gum::MarkovBlanket::toDot(), 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.
| std::list< NodeId > & gum::prm::gspan::DFSTree< GUM_SCALAR >::children | ( | const Pattern & | p | ) |
Returns the list of p children in this DFSTree.
Definition at line 427 of file DFSTree_tpl.h.
References _data_, and GUM_ERROR.
Referenced by _addChild_().
| const std::list< NodeId > & gum::prm::gspan::DFSTree< GUM_SCALAR >::children | ( | const Pattern & | p | ) | const |
|
overridevirtualinherited |
removes all the nodes and arcs from the graph
Reimplemented from gum::NodeGraphPart.
Reimplemented in gum::MixedGraph.
Definition at line 67 of file diGraph_inl.h.
References gum::ArcGraphPart::clearArcs(), and gum::NodeGraphPart::clearNodes().
Referenced by operator=().
|
inherited |
removes all the arcs from the ArcGraphPart
Definition at line 104 of file arcGraphPart.cpp.
References _arcs_, _children_, _parents_, gum::Set< Key >::clear(), GUM_EMIT2, gum::__sig__::BasicSignaler< Args... >::hasListener(), and onArcDeleted.
Referenced by ~ArcGraphPart(), gum::DiGraph::clear(), gum::MixedGraph::clear(), operator=(), operator=(), and gum::MixedGraph::operator=().
|
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 |
Build a complete DiGraph with n nodes.
| int | n |
Definition at line 58 of file diGraph.cpp.
References DiGraph(), addArc(), and gum::NodeGraphPart::addNodes().
|
inherited |
returns a property {node:id of weakly connected component}
Definition at line 127 of file diGraph_inl.h.
References gum::graph::connectedComponents().
Referenced by gum::DAGmodel::connectedComponents().
| DFSTree< GUM_SCALAR >::PatternData & gum::prm::gspan::DFSTree< GUM_SCALAR >::data | ( | const Pattern & | p | ) |
| p | The pattern |
Definition at line 493 of file DFSTree_tpl.h.
References _data_.
Referenced by _initialiaze_root_(), addRoot(), and growPattern().
| const DFSTree< GUM_SCALAR >::PatternData & gum::prm::gspan::DFSTree< GUM_SCALAR >::data | ( | const Pattern & | p | ) | const |
returns the set of all descendants of id (nodes reachable from id)
Definition at line 121 of file diGraph_inl.h.
References gum::graph::descendants().
Referenced by gum::DAGmodel::descendants(), gum::EssentialGraph::descendants(), gum::MarkovBlanket::descendants(), gum::DoorCriteria::enumerateBackdoorSets(), gum::Separation::isDescendantOf(), gum::DoorCriteria::nodesOnDirectedPaths(), and gum::DoorCriteria::satisfiesBackdoorCriterion().
|
inherited |
returns a directed path from node1 to node2, or std::nullopt if none
Definition at line 109 of file diGraph_inl.h.
References gum::graph::directedPath().
|
inherited |
returns a shortest path from node1 to node2 ignoring arc orientation, or std::nullopt if none
Definition at line 115 of file diGraph_inl.h.
References gum::graph::directedUnorientedPath().
|
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 |
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 ArcGraphPart contains any arc
Definition at line 56 of file arcGraphPart_inl.h.
References _arcs_, and gum::Set< Key >::empty().
|
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().
|
virtualinherited |
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_, gum::Set< Key >::erase(), 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(), gum::DAGCycleDetector::eraseArc(), 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_().
|
inherited |
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 gum::Arc::Arc(), _children_, gum::Set< Key >::beginSafe(), children(), gum::Set< Key >::endSafe(), and eraseArc().
|
overridevirtualinherited |
remove a node and its adjacent arcs from the graph
| id | the id of the node to be removed |
Reimplemented from gum::NodeGraphPart.
Reimplemented in gum::MixedGraph.
Definition at line 93 of file diGraph_inl.h.
References gum::NodeGraphPart::eraseNode(), gum::ArcGraphPart::unvirtualizedEraseChildren(), and gum::ArcGraphPart::unvirtualizedEraseParents().
Referenced by gum::BarrenNodesFinder::barrenNodes(), gum::prm::gspan::Pattern::pop_back(), gum::Separation::reduceForDSeparation(), and gum::prm::gspan::Pattern::remove().
|
inherited |
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 gum::Arc::Arc(), _parents_, gum::Set< Key >::beginSafe(), gum::Set< Key >::endSafe(), eraseArc(), and parents().
|
protectedinherited |
a (virtualized) function to remove a given set of arcs
Definition at line 127 of file arcGraphPart_inl.h.
References eraseArc().
Referenced by listMapArcs().
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::DAGmodel::exists(), gum::prm::gspan::Pattern::exists(), gum::UGmodel::exists(), gum::learning::IBNLearner::learnDag_(), and populateNodesFromProperty().
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_, and gum::Set< Key >::contains().
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::DAGCycleDetector::addArc(), gum::DoorCriteria::enumerateBackdoorSets(), eraseArc(), gum::DAGCycleDetector::eraseArc(), gum::prm::gspan::Pattern::exists(), gum::DAGmodel::existsArc(), gum::Separation::isBackdoorSeparated(), gum::learning::ConstraintBasedLearning::isForbiddenArc_(), gum::learning::ConstraintBasedLearning::isForbiddenEdge_(), 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_.
returns true iff the NodeGraphPart contains the given nodeId
Definition at line 301 of file nodeGraphPart_inl.h.
References _boundVal_, and _inHoles_().
Referenced by gum::SpanningForestPrim::_compute_(), gum::SpanningForestPrim::_computeInAComponent_(), gum::CausalFormula< GUM_SCALAR >::_ensureVariablesExist(), gum::SpanningForestPrim::_exploreNode_(), gum::OrderedEliminationSequenceStrategy::_isOrderNeeded_(), gum::DefaultPartialOrderedEliminationSequenceStrategy::eliminationUpdate(), gum::OrderedEliminationSequenceStrategy::eliminationUpdate(), eraseNode(), gum::PAG::eraseNode(), exists(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::Separation::isForwardSeparated(), gum::PartialOrderedEliminationSequenceStrategy::isPartialOrderNeeded_(), gum::graph::markovBlanket(), gum::graph::moralizedAncestralGraph(), gum::UndiGraph::partialUndiGraph(), populateNodesFromProperty(), gum::Separation::reduceForDSeparation(), setName(), gum::OrderedEliminationSequenceStrategy::setOrder(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
returns the union of families of all nodes in ids
Definition at line 125 of file diGraph_inl.h.
References gum::graph::family().
returns { id } ∪ parents(id)
Definition at line 123 of file diGraph_inl.h.
References gum::graph::family().
Referenced by gum::DAGmodel::family(), and gum::DAGmodel::family().
| double gum::prm::gspan::DFSTree< GUM_SCALAR >::frequency | ( | const Pattern & | p | ) | const |
Returns the frequency of p respecting it's maximal independent set.
| p | The pattern |
Definition at line 488 of file DFSTree_tpl.h.
References _data_, and max_indep_set().
| Pattern & gum::prm::gspan::DFSTree< GUM_SCALAR >::growPattern | ( | Pattern & | p, |
| EdgeGrowth< GUM_SCALAR > & | edge_growth, | ||
| Size | min_freq ) |
Add a one edge growth of p as one of its child.
The child is inserted lexicographically among the children of p. However if the child is found to be not minimal an OperationNotAllowed is raised.
| p | The Pattern from which a one edge growth is spawned. |
| edge_growth | The data about the edge growth of p. |
| min_freq | minimum number of occurrence to be used as a pattern |
| FatalError | Raised if the grow is an illegal backedge growth. |
| OperationNotAllowed | Raised if the grow is found to be not minimal. |
Definition at line 244 of file DFSTree_tpl.h.
References gum::prm::gspan::Pattern::Pattern(), _addChild_(), _checkGrowth_(), _data_, _is_new_seq_(), _strategy_, data(), gum::Set< Key >::exists(), GUM_ERROR, gum::SequenceImplementation< Key, Gen >::insert(), gum::Set< Key >::insert(), and gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::matches.
checks whether there exists a directed path from from to to
If from==to, this function checks if a directed cycle containing from exists.
| from | |
| to |
Definition at line 114 of file diGraph.cpp.
References gum::graph::hasDirectedPath().
Referenced by gum::DAG::addArc(), and gum::PDAG::addArc().
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 |
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().
| const InterfaceGraph< GUM_SCALAR > & gum::prm::gspan::DFSTree< GUM_SCALAR >::internalGraph | ( | ) | const |
Returns the list of root patterns in this DFSTree.
Definition at line 477 of file DFSTree_tpl.h.
References _graph_.
| UndiGraph & gum::prm::gspan::DFSTree< GUM_SCALAR >::iso_graph | ( | const Pattern & | p | ) |
Returns the isomorphism graph of p in the interface graph.
The isomorphism graph is a undirected graph in which each node represents a set of PRMInstance<GUM_SCALAR> matching p in the interface graph.
If there exists an edge between two nodes in the isomorphism graph, then the two respective set of instances are not disjoint.
| p | The pattern for which we want the isomorphism graph. |
Definition at line 453 of file DFSTree_tpl.h.
| Sequence< PRMInstance< GUM_SCALAR > * > & gum::prm::gspan::DFSTree< GUM_SCALAR >::iso_map | ( | const Pattern & | p, |
| NodeId | node ) |
Given a pattern and a node in its isomorphism graph, this methods returns the sequence of instance matching p in the interface graph.
The sequence of instances respect DSF subscripting. Each node in the pattern's graph have a DSF subscript from 1 to n, where n is the number of nodes in the pattern's graph.
If for a given match you want the k-th instance repecting p's DFS subscripting, then it will be the (k - 1)th element in the sequence.
| p | The pattern for which we want a match in the interface graph. |
| node | The node in p isomorphism graph for which we want the matching set if instances. |
| NotFound | Raised if p or node does not exists. |
Definition at line 460 of file DFSTree_tpl.h.
References _data_, and GUM_ERROR.
Referenced by _is_new_seq_().
|
inherited |
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 |
References eraseSetOfArcs_(), and unvirtualizedEraseSetOfArcs_().
|
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().
| Set< NodeId > & gum::prm::gspan::DFSTree< GUM_SCALAR >::max_indep_set | ( | const Pattern & | p | ) |
Returns the maximal independent set of p isomorphism graph.
| p | The pattern for which we want its maximal independent set. |
Definition at line 470 of file DFSTree_tpl.h.
References _data_, and GUM_ERROR.
Referenced by frequency().
|
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().
|
inherited |
returns a new node id, not yet used by any node
Definition at line 243 of file nodeGraphPart_inl.h.
References _boundVal_, _holes_, gum::Set< Key >::begin(), and gum::Set< Key >::empty().
Referenced by populateNodesFromProperty().
|
inherited |
return *this as a NodeGraphPart
Definition at line 379 of file nodeGraphPart_inl.h.
References NodeGraphPart().
Referenced by gum::CausalModel< GUM_SCALAR >::CausalModel(), gum::prm::StructuredInference< GUM_SCALAR >::CData::CData(), gum::MarkovBlanket::MarkovBlanket(), gum::DoCalculus< GUM_SCALAR >::_ancestorsIn_(), gum::DoCalculus< GUM_SCALAR >::_cDecomposition_(), gum::KTBNInference< GUM_SCALAR >::_compileWindow_(), gum::SpanningForestPrim::_compute_(), gum::StaticTriangulation::_computeMaxPrimeJunctionTree_(), gum::KTBNInference< GUM_SCALAR >::_fillWindow_(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::prm::LayerGenerator< GUM_SCALAR >::_generateClassDag_(), gum::DoCalculus< GUM_SCALAR >::_ID_(), 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::DoCalculus< GUM_SCALAR >::_topoObserved_(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::DoorCriteria::enumerateBackdoorSets(), gum::StaticTriangulation::fillIns(), gum::CausalModel< GUM_ELEMENT >::inducedCausalSubModel(), gum::learning::ConstraintBasedLearning::initGraph_(), gum::learning::FCI::learnPAG(), gum::DAG::moralizedAncestralGraph(), gum::graph::moralizedAncestralGraph(), gum::PDAG::moralizedAncestralGraph(), gum::EssentialGraph::nodes(), gum::MarkovBlanket::nodes(), 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::EssentialGraph::toDot(), gum::MarkovBlanket::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::BarrenNodesFinder::barrenNodes(), gum::BinaryJoinTreeConverterDefault::convert(), and nodesPropertyFromVal().
|
inherited |
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==().
tests whether two DiGraphs are identical (same nodes, same arcs)
| g | the DiGraph with which "this" is compared |
Definition at line 103 of file diGraph_inl.h.
References DiGraph(), gum::ArcGraphPart::operator==(), and gum::NodeGraphPart::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==().
| Pattern & gum::prm::gspan::DFSTree< GUM_SCALAR >::parent | ( | const Pattern & | p | ) |
Returns the parent of p in this DFSTree.
Definition at line 405 of file DFSTree_tpl.h.
References _node_map_, GUM_ERROR, and gum::ArcGraphPart::parents().
| const Pattern & gum::prm::gspan::DFSTree< GUM_SCALAR >::parent | ( | const Pattern & | p | ) | const |
Returns the parent of p in this DFSTree.
Definition at line 416 of file DFSTree_tpl.h.
References _node_map_, GUM_ERROR, and gum::ArcGraphPart::parents().
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::DoCalculus< GUM_SCALAR >::_topoObserved_(), gum::DoorCriteria::backdoorReach(), gum::BarrenNodesFinder::barrenNodes(), 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::DAGmodel::parents(), gum::DAGmodel::parents(), gum::EssentialGraph::parents(), gum::EssentialGraph::parents(), gum::MarkovBlanket::parents(), gum::MarkovBlanket::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().
| Pattern & gum::prm::gspan::DFSTree< GUM_SCALAR >::pattern | ( | NodeId | id | ) |
Returns the pattern represented by id in this DFSTree.
Definition at line 441 of file DFSTree_tpl.h.
References _node_map_, and GUM_ERROR.
Referenced by _addChild_().
| const Pattern & gum::prm::gspan::DFSTree< GUM_SCALAR >::pattern | ( | NodeId | id | ) | const |
Returns the pattern represented by id in this DFSTree.
Definition at line 447 of file DFSTree_tpl.h.
References _node_map_, and GUM_ERROR.
|
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().
| std::list< NodeId > & gum::prm::gspan::DFSTree< GUM_SCALAR >::roots | ( | ) |
| const std::list< NodeId > & gum::prm::gspan::DFSTree< GUM_SCALAR >::roots | ( | ) | const |
Returns the list of root patterns in this DFSTree.
Definition at line 400 of file DFSTree_tpl.h.
References _roots_.
|
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(), gum::EssentialGraph::skeleton(), and gum::CausalModel< GUM_ELEMENT >::toDot().
|
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::KTBNInference< GUM_SCALAR >::_compileWindow_(), gum::StaticTriangulation::_computeMaxPrimeJunctionTree_(), gum::StaticTriangulation::_computeRecursiveThinning_(), gum::OrderedEliminationSequenceStrategy::_isOrderNeeded_(), gum::StaticTriangulation::_triangulate_(), gum::BarrenNodesFinder::barrenNodes(), gum::PartialOrderedEliminationSequenceStrategy::isPartialOrderNeeded_(), nodesPropertyFromFunction(), nodesPropertyFromVal(), populateNodesFromProperty(), gum::BayesBall::relevantTensors(), gum::dSeparationAlgorithm::relevantTensors(), gum::dSeparationAlgorithm::requisiteNodes(), gum::DAGmodel::size(), gum::EssentialGraph::size(), gum::MarkovBlanket::size(), gum::prm::gspan::Pattern::size(), gum::UGmodel::size(), and gum::UndiGraph::toDot().
|
inherited |
indicates the number of arcs stored within the ArcGraphPart
Definition at line 58 of file arcGraphPart_inl.h.
References _arcs_, and gum::Set< Key >::size().
Referenced by gum::DAGmodel::sizeArcs(), gum::EssentialGraph::sizeArcs(), gum::MarkovBlanket::sizeArcs(), and gum::prm::gspan::Pattern::sizeArcs().
|
inherited |
returns the number of nodes in the NodeGraphPart
Definition at line 295 of file nodeGraphPart_inl.h.
References _boundVal_, _holes_, and gum::Set< Key >::size().
Referenced by gum::BinaryJoinTreeConverterDefault::_markConnectedComponent_(), asNodeSet(), gum::BarrenNodesFinder::barrenNodes(), gum::BinaryJoinTreeConverterDefault::convert(), emptyNodes(), populateNodesFromProperty(), gum::EliminationSequenceStrategy::setGraph(), size(), gum::EssentialGraph::sizeNodes(), and gum::MarkovBlanket::sizeNodes().
| SearchStrategy< GUM_SCALAR > & gum::prm::gspan::DFSTree< GUM_SCALAR >::strategy | ( | ) |
strategy getter
Definition at line 504 of file DFSTree_tpl.h.
References _strategy_.
Referenced by DFSTree(), and addRoot().
| const SearchStrategy< GUM_SCALAR > & gum::prm::gspan::DFSTree< GUM_SCALAR >::strategy | ( | ) | const |
|
virtualinherited |
to friendly display the content of the graph in the DOT syntax
| name | The graph name in the dot syntax. Default is G. |
Reimplemented in gum::MixedGraph, gum::PDAG, and gum::prm::gspan::Pattern.
Definition at line 93 of file diGraph.cpp.
References gum::ArcGraphPart::arcs(), gum::NodeGraphPart::dotNodeLabel(), and gum::NodeGraphPart::nodes().
Build and return a topological order.
| InvalidDirectedCycle | Raised if this DiGraph contains cycles. |
Definition at line 131 of file diGraph_inl.h.
References gum::graph::topologicalOrder().
Referenced by gum::learning::SimpleMiic::learnPDAG(), gum::learning::SimpleMiic::learnStructure(), and gum::DAGmodel::topologicalOrder().
|
overridevirtualinherited |
to friendly display the content of the graph
Reimplemented from gum::NodeGraphPart.
Reimplemented in gum::MixedGraph.
Definition at line 86 of file diGraph.cpp.
References gum::ArcGraphPart::toString(), and gum::NodeGraphPart::toString().
Referenced by gum::operator<<().
|
inherited |
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 gum::Arc::Arc(), _children_, gum::Set< Key >::beginSafe(), children(), gum::Set< Key >::endSafe(), and eraseArc().
Referenced by gum::DiGraph::eraseNode(), and gum::MixedGraph::eraseNode().
|
inherited |
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 gum::Arc::Arc(), _parents_, gum::Set< Key >::beginSafe(), gum::Set< Key >::endSafe(), eraseArc(), and parents().
Referenced by gum::DiGraph::eraseNode(), and gum::MixedGraph::eraseNode().
|
protectedinherited |
similar to eraseSetOfArcs_ except that it is unvirtualized
Definition at line 160 of file arcGraphPart_inl.h.
References eraseArc().
Referenced by listMapArcs().
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().
|
privateinherited |
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 |
Data about patterns in this DFSTree.
Definition at line 277 of file DFSTree.h.
Referenced by ~DFSTree(), _addChild_(), _initialiaze_root_(), addRoot(), children(), children(), data(), data(), frequency(), growPattern(), iso_graph(), iso_map(), and max_indep_set().
|
private |
|
private |
|
privateinherited |
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().
|
private |
|
private |
The strategy used to prune the search tree.
Definition at line 280 of file DFSTree.h.
Referenced by DFSTree(), ~DFSTree(), growPattern(), strategy(), and strategy().
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().
Definition at line 283 of file nodeGraphPart.h.
Referenced by addNode(), and addNodeWithId().
Definition at line 284 of file nodeGraphPart.h.
Referenced by _clearNodes_(), and eraseNode().