![]() |
aGrUM
0.16.0
|
This contains all the information we want for a node in a DFSTree. More...
#include <agrum/PRM/gspan/pattern.h>
Public Member Functions | |
Constructor and destructor. | |
Pattern () | |
Default constructor. More... | |
Pattern (const Pattern &source) | |
Copy constructor. More... | |
~Pattern () | |
Destructor. More... | |
Graphical getters and setters. | |
NodeId | addNodeWithLabel (LabelData &l) |
Insert a node with the given LabelData. More... | |
LabelData & | label (NodeId node) |
Returns the LabelData assigned to node. More... | |
const LabelData & | label (NodeId node) const |
Returns the LabelData assigned to node. More... | |
LabelData & | label (NodeId i, NodeId j) |
Returns the LabelData assigned to arc. More... | |
const LabelData & | label (NodeId i, NodeId j) const |
Returns the LabelData assigned to arc. More... | |
LabelData & | label (const Arc &arc) |
Returns the LabelData assigned to arc. More... | |
const LabelData & | label (const Arc &arc) const |
Returns the LabelData assigned to arc. More... | |
LabelData & | lastAdded () |
Insert a node with the given LabelData. More... | |
const LabelData & | lastAdded () const |
Insert a node with the given LabelData. More... | |
void | addArc (NodeId i, NodeId j, LabelData &l) |
Add an arc to this Pattern. More... | |
bool | exists (NodeId id) const |
Returns true if id is a node in this Pattern. More... | |
bool | exists (NodeId tail, NodeId head) const |
Returns true if (tail, head) is an arc in this Pattern. More... | |
Size | size () const |
Returns the number of nodes in this Pattern. More... | |
Size | sizeArcs () const |
Returns the number of arcs in this Pattern. More... | |
void | rightmostPath (std::list< NodeId > &r_path) const |
Fill r_path with the rightmost path of this Pattern. The list is supposed empty. More... | |
std::string | toDot (size_t name) const |
Print the pattern in the DOT syntax. More... | |
Access to topology | |
const NodeGraphPart & | nodes () const |
const ArcSet & | arcs () const |
DFSCode related methods. | |
DFSCode & | code () |
Returns the DFSCode of this Pattern. More... | |
const DFSCode & | code () const |
Returns the DFSCode of this Pattern. More... | |
EdgeCode & | edgeCode (NodeId tail, NodeId head) |
Returns the EdgeCode of an edge of this Pattern. More... | |
EdgeCode & | edgeCode (const Arc &arc) |
Returns the EdgeCode of an edge of this Pattern. More... | |
const EdgeCode & | edgeCode (NodeId tail, NodeId head) const |
Returns the EdgeCode of an edge of this Pattern. More... | |
const EdgeCode & | edgeCode (const Arc &arc) const |
Returns the EdgeCode of an edge of this Pattern. More... | |
void | pop_back () |
Remove the last EdgeCode of this pattern. More... | |
void | remove (NodeId node) |
Remove a node if it has no neighbors, raise an OperationNotAllowed otherwise. More... | |
bool | isMinimal () |
Returns the DFSCode of this Pattern. More... | |
This contains all the information we want for a node in a DFSTree.
Several rules are used regarding nodes in Pattern::graph. First nodes are added respecting a depth-first search, thus each node is labelled from 1 to n, where n is the number of nodes in Pattern::graph.
Given two nodes id i and j, if i < j then i was discovered before j in the depth first search.
To retrieve the depth first search tree from Pattern::graph simple consider only arcs (u, v) with u < v. The set of arcs { (u,v) | u < v} is called the forward edge set and the set of arcs { (u,v) | u > v} is called the backward edge set.
The orientation in Pattern::graph is only used to differentiate forward edges from backward edges.
|
inherited |
Definition at line 81 of file arcGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 261 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 263 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 260 of file nodeGraphPart.h.
|
inherited |
types for STL compliance
Definition at line 262 of file nodeGraphPart.h.
|
inherited |
Definition at line 270 of file nodeGraphPart.h.
|
inherited |
Definition at line 272 of file nodeGraphPart.h.
|
inherited |
Definition at line 269 of file nodeGraphPart.h.
|
inherited |
Definition at line 271 of file nodeGraphPart.h.
INLINE gum::prm::gspan::Pattern::Pattern | ( | ) |
Default constructor.
Definition at line 35 of file pattern_inl.h.
gum::prm::gspan::Pattern::Pattern | ( | const Pattern & | source | ) |
Copy constructor.
Definition at line 40 of file pattern.cpp.
References addArc(), addNodeWithLabel(), code(), gum::prm::gspan::DFSCode::codes, gum::HashTable< Key, Val, Alloc >::insert(), label(), and size().
INLINE gum::prm::gspan::Pattern::~Pattern | ( | ) |
Returns true if the expand code by adding and edge betwenne u and v is minimal with respect to __code.
Definition at line 99 of file pattern.cpp.
References __rec(), addArc(), addNodeWithLabel(), gum::ArcGraphPart::children(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::insert(), label(), and gum::ArcGraphPart::parents().
Referenced by isMinimal().
|
private |
A non recursive bugged version of __rec.
Definition at line 189 of file pattern.cpp.
References addArc(), addNodeWithLabel(), gum::ArcGraphPart::children(), code(), gum::prm::gspan::DFSCode::codes, gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::eraseFirst(), gum::ArcGraphPart::existsArc(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::existsFirst(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::first(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::insert(), label(), gum::ArcGraphPart::parents(), pop_back(), remove(), rightmostPath(), and gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::second().
|
private |
Recurisve method used by __expandCodeIsMinimal.
Definition at line 128 of file pattern.cpp.
References addArc(), addNodeWithLabel(), gum::ArcGraphPart::children(), code(), gum::prm::gspan::DFSCode::codes, gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::eraseFirst(), gum::ArcGraphPart::existsArc(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::existsFirst(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::first(), gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::insert(), label(), gum::ArcGraphPart::parents(), pop_back(), remove(), rightmostPath(), and gum::BijectionImplementation< T1, T2, Alloc, std::is_scalar< T1 >::value &&std::is_scalar< T2 >::value >::second().
Referenced by __expandCodeIsMinimal().
|
protectedinherited |
a (virtualized) function to remove a given set of arcs
Definition at line 91 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::eraseArc().
|
protectedinherited |
similar to _eraseSetOfArcs except that it is unvirtualized
Definition at line 124 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::eraseArc().
Add an arc to this Pattern.
This create an EdgeCode and check if it respects neighborhood restriction, if not an exception is raised.
i | The DFS subscript of the first node in the code. |
j | The DFS subscript of the second node in the code. |
l | The label data of the added edge. |
OperationNotAllowed | Raised if the neighborhood restriction is not respected. |
Definition at line 118 of file pattern_inl.h.
References __arc_map, __node_map, gum::DiGraph::addArc(), code(), gum::prm::gspan::DFSCode::codes, gum::NodeGraphPart::exists(), GUM_ERROR, gum::prm::gspan::LabelData::id, and gum::prm::gspan::DFSCode::validNeighbors().
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__checkGrowth(), __expandCodeIsMinimal(), __not_rec(), __rec(), gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot(), and Pattern().
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::DAG.
Definition at line 35 of file diGraph_inl.h.
References gum::ArcGraphPart::addArc(), gum::NodeGraphPart::exists(), and GUM_ERROR.
Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::MarkovBlanket::__buildMarkovBlanket(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::learning::Miic::_propagatesHead(), addArc(), gum::DAG::addArc(), and gum::DAGCycleDetector::addArc().
|
virtualinherited |
insert a new node and return its id
Reimplemented in gum::CliqueGraph.
Definition at line 253 of file nodeGraphPart_inl.h.
References GUM_EMIT1.
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__addChild(), gum::prm::StructuredInference< GUM_SCALAR >::__addEdgesInReducedGraph(), gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::__addInterface2Dag(), gum::prm::ClassDependencyGraph< GUM_SCALAR >::__addNode(), gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__addTypes2Dag(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::__buildPatternGraph(), gum::prm::StructuredInference< GUM_SCALAR >::__buildPatternGraph(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__checkAndAddNodesToDag(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::gspan::DFSTree< GUM_SCALAR >::__initialiaze_root(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::_insertNode(), gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot(), gum::prm::gspan::DFSTree< GUM_SCALAR >::growPattern(), gum::IncrementalGraphLearner< AttributeSelection, isScalar >::IncrementalGraphLearner(), gum::prm::gspan::EdgeGrowth< GUM_SCALAR >::insert(), and gum::LeafAggregator::update().
insert n nodes
n | the number of nodes to add |
Definition at line 271 of file nodeGraphPart_inl.h.
|
virtualinherited |
try to insert a node with the given id
DuplicateElement | exception if the id already exists |
Definition at line 132 of file nodeGraphPart.cpp.
References gum::NodeGraphPart::__boundVal, gum::NodeGraphPart::__eraseHole(), gum::NodeGraphPart::__holes, gum::NodeGraphPart::__holes_resize_policy, gum::NodeGraphPart::__holes_size, gum::NodeGraphPart::__inHoles(), gum::NodeGraphPart::__updateEndIteratorSafe(), GUM_EMIT1, GUM_ERROR, gum::Set< Key, Alloc >::insert(), and gum::NodeGraphPart::onNodeAdded.
Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::MarkovBlanket::__buildMarkovBlanket(), gum::SpanningForestPrim::__computeInAComponent(), gum::learning::genericBNLearner::__learnDAG(), gum::learning::genericBNLearner::__prepare_miic_3off2(), gum::prm::GSpan< GUM_SCALAR >::__sortPatterns(), gum::InfluenceDiagram< GUM_SCALAR >::_addNode(), gum::InfluenceDiagram< GUM_SCALAR >::_moralGraph(), addNodeWithLabel(), gum::prm::StructuredInference< GUM_SCALAR >::CData::CData(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::BayesNetFragment< GUM_SCALAR >::installNode(), gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph(), gum::learning::Miic::learnStructure(), gum::UndiGraph::partialUndiGraph(), gum::EssentialGraph::skeleton(), and gum::learning::StructuralConstraintDAG::StructuralConstraintDAG().
Insert a node with the given LabelData.
Definition at line 41 of file pattern_inl.h.
References __last, __node_map, gum::NodeGraphPart::addNodeWithId(), and size().
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__checkGrowth(), __expandCodeIsMinimal(), __not_rec(), __rec(), gum::prm::gspan::DFSTree< GUM_SCALAR >::addRoot(), and Pattern().
INLINE const ArcSet & gum::prm::gspan::Pattern::arcs | ( | ) | const |
Definition at line 170 of file pattern_inl.h.
References gum::ArcGraphPart::arcs().
Referenced by toDot().
|
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 |
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 |
returns a copy of the set of nodes represented by the NodeGraphPart
Definition at line 361 of file nodeGraphPart_inl.h.
References gum::Set< Key, Alloc >::insert().
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::getPartialTemporalOrder().
|
noexceptinherited |
a begin iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 333 of file nodeGraphPart_inl.h.
References gum::NodeGraphPartIterator::_validate().
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::parent().
|
inherited |
a begin iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 319 of file nodeGraphPart_inl.h.
References gum::NodeGraphPartIterator::_validate().
|
inherited |
returns a number n such that all node ids are strictly lower than n
Definition at line 308 of file nodeGraphPart_inl.h.
Referenced by gum::NodeGraphPart::__clearNodes(), gum::StaticTriangulation::__computeEliminationTree(), gum::NodeGraphPartIterator::_setPos(), and gum::NodeGraphPartIterator::_validate().
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 62 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__checkChildren(), and gum::ArcGraphPart::__children.
Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::EssentialGraph::__buildEssentialGraph(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), __expandCodeIsMinimal(), __not_rec(), __rec(), gum::InfluenceDiagram< GUM_SCALAR >::_getChildrenDecision(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::_initialize(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::_makeInferenceNodeToNeighbours(), gum::ArcGraphPart::ArcGraphPart(), gum::MarkovBlanket::children(), gum::EssentialGraph::children(), gum::DAGmodel::children(), gum::ArcGraphPart::directedUnorientedPath(), gum::InfluenceDiagram< GUM_SCALAR >::erase(), gum::ArcGraphPart::eraseChildren(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), gum::DiGraph::hasDirectedPath(), isMinimal(), gum::MixedGraph::mixedUnorientedPath(), gum::BayesBall::relevantPotentials(), gum::dSeparation::relevantPotentials(), remove(), gum::BayesBall::requisiteNodes(), gum::dSeparation::requisiteNodes(), gum::MarkovBlanket::toDot(), gum::EssentialGraph::toDot(), gum::InfluenceDiagram< GUM_SCALAR >::toDot(), gum::MixedGraph::toDot(), and gum::ArcGraphPart::unvirtualizedEraseChildren().
|
virtualinherited |
removes all the nodes and arcs from the graph
Reimplemented from gum::NodeGraphPart.
Reimplemented in gum::MixedGraph.
Definition at line 43 of file diGraph_inl.h.
References gum::ArcGraphPart::clearArcs(), and gum::NodeGraphPart::clearNodes().
Referenced by gum::DiGraph::operator=().
|
inherited |
removes all the arcs from the ArcGraphPart
Definition at line 79 of file arcGraphPart.cpp.
References gum::ArcGraphPart::__arcs, gum::ArcGraphPart::__children, gum::ArcGraphPart::__parents, gum::Set< Key, Alloc >::clear(), GUM_EMIT2, and gum::ArcGraphPart::onArcDeleted.
Referenced by gum::DiGraph::clear(), gum::MixedGraph::clear(), gum::ArcGraphPart::operator=(), gum::MixedGraph::operator=(), and gum::ArcGraphPart::~ArcGraphPart().
|
virtualinherited |
remove all the nodes from the NodeGraphPart
Definition at line 310 of file nodeGraphPart_inl.h.
Referenced by gum::DiGraph::clear(), gum::UndiGraph::clear(), gum::MixedGraph::clear(), and gum::MixedGraph::operator=().
INLINE DFSCode & gum::prm::gspan::Pattern::code | ( | ) |
Returns the DFSCode of this Pattern.
Definition at line 173 of file pattern_inl.h.
References __code.
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__addChild(), gum::prm::gspan::DFSTree< GUM_SCALAR >::__checkGrowth(), __not_rec(), __rec(), gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining(), addArc(), gum::prm::gspan::DFSTree< GUM_SCALAR >::growPattern(), isMinimal(), and Pattern().
INLINE const DFSCode & gum::prm::gspan::Pattern::code | ( | ) | const |
Returns the DFSCode of this Pattern.
Definition at line 176 of file pattern_inl.h.
References __code.
|
inherited |
returns a directed path from node1 to node2 belonging to the set of arcs
node1 | the id from which the path begins |
node2 | the id to which the path ends |
NotFound | exception is raised if no path can be found between the two nodes |
Definition at line 155 of file arcGraphPart.cpp.
References gum::List< Val, Alloc >::empty(), gum::HashTable< Key, Val, Alloc >::exists(), gum::List< Val, Alloc >::front(), GUM_ERROR, gum::HashTable< Key, Val, Alloc >::insert(), gum::ArcGraphPart::parents(), gum::List< Val, Alloc >::popFront(), and gum::List< Val, Alloc >::pushBack().
Referenced by gum::learning::Miic::_orientation_latents().
|
inherited |
returns an unoriented (directed) path from node1 to node2 in the arc set
node1 | the id from which the path begins |
node2 | the id to which the path ends |
NotFound | exception is raised if no path can be found between the two nodes |
Definition at line 198 of file arcGraphPart.cpp.
References gum::ArcGraphPart::children(), gum::List< Val, Alloc >::empty(), gum::HashTable< Key, Val, Alloc >::exists(), gum::List< Val, Alloc >::front(), GUM_ERROR, gum::HashTable< Key, Val, Alloc >::insert(), gum::ArcGraphPart::parents(), gum::List< Val, Alloc >::popFront(), and gum::List< Val, Alloc >::pushBack().
Returns the EdgeCode of an edge of this Pattern.
Definition at line 179 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__checkGrowth().
Returns the EdgeCode of an edge of this Pattern.
Definition at line 186 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Returns the EdgeCode of an edge of this Pattern.
Definition at line 193 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Returns the EdgeCode of an edge of this Pattern.
Definition at line 200 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
|
inherited |
alias for emptyNodes
Definition at line 306 of file nodeGraphPart_inl.h.
Referenced by remove().
|
inherited |
indicates wether the ArcGraphPart contains any arc
Definition at line 35 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__arcs, and gum::Set< Key, Alloc >::empty().
|
inherited |
indicates whether there exists nodes in the NodeGraphPart
Definition at line 304 of file nodeGraphPart_inl.h.
|
noexceptinherited |
the end iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 339 of file nodeGraphPart_inl.h.
|
noexceptinherited |
the end iterator to parse the set of nodes contained in the NodeGraphPart
Definition at line 329 of file nodeGraphPart_inl.h.
|
virtualinherited |
removes an arc from the ArcGraphPart
arc | the arc to be removed |
Definition at line 79 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__arcs, gum::ArcGraphPart::__children, gum::ArcGraphPart::__parents, gum::Set< Key, Alloc >::erase(), gum::ArcGraphPart::existsArc(), GUM_EMIT2, gum::Arc::head(), gum::ArcGraphPart::onArcDeleted, and gum::Arc::tail().
Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::learning::genericBNLearner::__learnDAG(), gum::ArcGraphPart::_eraseSetOfArcs(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::BayesNetFragment< GUM_SCALAR >::_uninstallArc(), gum::ArcGraphPart::_unvirtualizedEraseSetOfArcs(), gum::DAGCycleDetector::eraseArc(), gum::InfluenceDiagram< GUM_SCALAR >::eraseArc(), gum::ArcGraphPart::eraseChildren(), gum::ArcGraphPart::eraseParents(), gum::learning::GreedyHillClimbing::learnStructure(), gum::learning::LocalSearchWithTabuList::learnStructure(), pop_back(), gum::BayesNet< double >::reverseArc(), gum::ArcGraphPart::unvirtualizedEraseChildren(), and gum::ArcGraphPart::unvirtualizedEraseParents().
|
inherited |
removes all the children of a given node
id | the node all the children of which will be removed |
Definition at line 110 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__children, gum::Set< Key, Alloc >::beginSafe(), gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::endSafe(), and gum::ArcGraphPart::eraseArc().
|
virtualinherited |
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 69 of file diGraph_inl.h.
References gum::NodeGraphPart::eraseNode(), gum::ArcGraphPart::unvirtualizedEraseChildren(), and gum::ArcGraphPart::unvirtualizedEraseParents().
Referenced by gum::BarrenNodesFinder::barrenNodes(), gum::InfluenceDiagram< GUM_SCALAR >::erase(), pop_back(), remove(), and gum::BayesNetFragment< GUM_SCALAR >::uninstallNode().
|
inherited |
erase all the parents of a given node
id | the node all the parents of which will be removed |
Definition at line 96 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__parents, gum::Set< Key, Alloc >::beginSafe(), gum::Set< Key, Alloc >::endSafe(), gum::ArcGraphPart::eraseArc(), and gum::ArcGraphPart::parents().
Returns true if id is a node in this Pattern.
Definition at line 139 of file pattern_inl.h.
References gum::NodeGraphPart::exists().
Returns true if (tail, head) is an arc in this Pattern.
Definition at line 142 of file pattern_inl.h.
References gum::ArcGraphPart::existsArc().
indicates whether a given arc exists
arc | the arc we test whether or not it belongs to the ArcGraphPart |
Definition at line 41 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__arcs, and gum::Set< Key, Alloc >::contains().
Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AorR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MarkovBlanket::__buildMarkovBlanket(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__directedPath(), gum::learning::Miic::__existsDirectedPath(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_multi(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__jump_poly(), __not_rec(), __rec(), gum::learning::Miic::_orientation_3off2(), gum::learning::Miic::_orientation_latents(), gum::learning::Miic::_orientation_miic(), gum::learning::Miic::_updateProbaTriples(), gum::DAGCycleDetector::addArc(), gum::ArcGraphPart::eraseArc(), gum::DAGCycleDetector::eraseArc(), gum::InfluenceDiagram< GUM_SCALAR >::eraseArc(), and exists().
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 45 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__parents.
returns true iff the NodeGraphPart contains the given nodeId
Definition at line 286 of file nodeGraphPart_inl.h.
Referenced by gum::MarkovBlanket::__buildMarkovBlanket(), gum::SpanningForestPrim::__compute(), gum::SpanningForestPrim::__computeInAComponent(), gum::SpanningForestPrim::__exploreNode(), gum::OrderedEliminationSequenceStrategy::__isOrderNeeded(), gum::PartialOrderedEliminationSequenceStrategy::_isPartialOrderNeeded(), gum::OrderedEliminationSequenceStrategy::eliminationUpdate(), gum::DefaultPartialOrderedEliminationSequenceStrategy::eliminationUpdate(), gum::InfluenceDiagram< GUM_SCALAR >::getDecisionGraph(), gum::BayesNetFragment< GUM_SCALAR >::isInstalledNode(), gum::UndiGraph::partialUndiGraph(), gum::OrderedEliminationSequenceStrategy::setOrder(), and gum::PartialOrderedEliminationSequenceStrategy::setPartialOrder().
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 137 of file diGraph.cpp.
References gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::contains(), gum::List< Val, Alloc >::empty(), gum::NodeGraphPart::exists(), gum::List< Val, Alloc >::front(), gum::Set< Key, Alloc >::insert(), gum::List< Val, Alloc >::popFront(), and gum::List< Val, Alloc >::pushBack().
Referenced by gum::DAG::addArc().
bool gum::prm::gspan::Pattern::isMinimal | ( | ) |
Returns the DFSCode of this Pattern.
Definition at line 56 of file pattern.cpp.
References __expandCodeIsMinimal(), gum::ArcGraphPart::children(), code(), gum::prm::gspan::DFSCode::codes, gum::prm::gspan::LabelData::id, label(), nodes(), and gum::ArcGraphPart::parents().
Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::__checkGrowth().
Returns the LabelData assigned to node.
Definition at line 50 of file pattern_inl.h.
References __node_map, and GUM_ERROR.
Referenced by __expandCodeIsMinimal(), __not_rec(), __rec(), gum::prm::gspan::TreeWidthSearch< GUM_SCALAR >::accept_root(), isMinimal(), Pattern(), and toDot().
Returns the LabelData assigned to node.
Definition at line 59 of file pattern_inl.h.
References __node_map, and GUM_ERROR.
Returns the LabelData assigned to arc.
Definition at line 82 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Returns the LabelData assigned to arc.
Definition at line 91 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Returns the LabelData assigned to arc.
Definition at line 100 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
Returns the LabelData assigned to arc.
Definition at line 109 of file pattern_inl.h.
References __arc_map, and GUM_ERROR.
INLINE LabelData & gum::prm::gspan::Pattern::lastAdded | ( | ) |
Insert a node with the given LabelData.
Definition at line 68 of file pattern_inl.h.
References __last, and GUM_ERROR.
INLINE const LabelData & gum::prm::gspan::Pattern::lastAdded | ( | ) | const |
Insert a node with the given LabelData.
Definition at line 75 of file pattern_inl.h.
References __last, and GUM_ERROR.
|
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 |
|
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 |
|
inherited |
returns a new node id, not yet used by any node
Definition at line 226 of file nodeGraphPart_inl.h.
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::_addNode().
INLINE const NodeGraphPart & gum::prm::gspan::Pattern::nodes | ( | ) | const |
Definition at line 166 of file pattern_inl.h.
References gum::NodeGraphPart::nodes().
Referenced by gum::prm::gspan::TreeWidthSearch< GUM_SCALAR >::accept_root(), and isMinimal().
|
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. |
Referenced by gum::InfluenceDiagram< GUM_SCALAR >::_getChildrenDecision(), gum::BarrenNodesFinder::barrenNodes(), gum::BinaryJoinTreeConverterDefault::convert(), gum::InfluenceDiagram< GUM_SCALAR >::existsPathBetween(), and gum::UndiGraph::hasUndirectedCycle().
|
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. |
|
inherited |
tests whether two ArcGraphParts contain different arcs
p | the ArcGraphPart that we compare with this |
Definition at line 157 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__arcs.
tests whether two DiGraphs are different
g | the DiGraph with which "this" is compared |
Definition at line 83 of file diGraph_inl.h.
References gum::DiGraph::operator==().
|
inherited |
check whether two NodeGraphParts contain different nodes
p | the NodeGraphPart to be compared with "this" |
Definition at line 357 of file nodeGraphPart_inl.h.
References gum::NodeGraphPartIterator::operator==().
|
inherited |
tests whether two ArcGraphParts contain the same arcs
p | the ArcGraphPart that we compare with this |
Definition at line 153 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__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 79 of file diGraph_inl.h.
References gum::ArcGraphPart::operator==(), and gum::NodeGraphPart::operator==().
Referenced by gum::DiGraph::operator!=().
|
inherited |
check whether two NodeGraphParts contain the same nodes
p | the NodeGraphPart to be compared with "this" |
Definition at line 343 of file nodeGraphPart_inl.h.
References gum::NodeGraphPart::__boundVal, and gum::NodeGraphPart::__holes.
Referenced by gum::UndiGraph::operator==(), gum::DiGraph::operator==(), and gum::MixedGraph::operator==().
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 57 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__checkParents(), and gum::ArcGraphPart::__parents.
Referenced by gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__AR(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::__connect(), gum::learning::Miic::__existsDirectedPath(), __expandCodeIsMinimal(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClassDag(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), __not_rec(), __rec(), gum::EssentialGraph::__strongly_protected(), gum::InfluenceDiagram< GUM_SCALAR >::_copyTables(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::_initialize(), gum::credal::CNLoopyPropagation< GUM_SCALAR >::_makeInferenceNodeToNeighbours(), gum::InfluenceDiagram< GUM_SCALAR >::_moralGraph(), gum::learning::Miic::_orientation_miic(), gum::learning::Miic::_propagatesHead(), gum::BarrenNodesFinder::barrenNodes(), gum::ArcGraphPart::directedPath(), gum::ArcGraphPart::directedUnorientedPath(), gum::learning::BNDatabaseGenerator< GUM_SCALAR >::drawSamples(), gum::ArcGraphPart::eraseParents(), gum::InfluenceDiagram< GUM_SCALAR >::getPartialTemporalOrder(), isMinimal(), gum::learning::Miic::learnStructure(), gum::MixedGraph::mixedOrientedPath(), gum::MixedGraph::mixedUnorientedPath(), gum::DAG::moralGraph(), gum::prm::gspan::DFSTree< GUM_SCALAR >::parent(), gum::MarkovBlanket::parents(), gum::EssentialGraph::parents(), gum::DAGmodel::parents(), gum::BayesBall::relevantPotentials(), gum::dSeparation::relevantPotentials(), remove(), gum::BayesBall::requisiteNodes(), gum::dSeparation::requisiteNodes(), rightmostPath(), and gum::ArcGraphPart::unvirtualizedEraseParents().
INLINE void gum::prm::gspan::Pattern::pop_back | ( | ) |
Remove the last EdgeCode of this pattern.
Definition at line 207 of file pattern_inl.h.
References __arc_map, __code, __node_map, gum::prm::gspan::DFSCode::codes, gum::ArcGraphPart::eraseArc(), gum::DiGraph::eraseNode(), gum::prm::gspan::EdgeCode::i, gum::prm::gspan::EdgeCode::isForward(), and gum::prm::gspan::EdgeCode::j.
Referenced by __not_rec(), and __rec().
|
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 64 of file nodeGraphPart.cpp.
References gum::NodeGraphPart::__boundVal, gum::NodeGraphPart::__holes, gum::NodeGraphPart::__holes_resize_policy, gum::NodeGraphPart::__holes_size, gum::NodeGraphPart::__updateEndIteratorSafe(), and gum::NodeGraphPart::clear().
Referenced by gum::DAGmodel::__moralGraph(), and gum::DAG::moralGraph().
|
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.
INLINE void gum::prm::gspan::Pattern::remove | ( | NodeId | node | ) |
Remove a node if it has no neighbors, raise an OperationNotAllowed otherwise.
Definition at line 225 of file pattern_inl.h.
References __node_map, gum::ArcGraphPart::children(), gum::NodeGraphPart::empty(), gum::DiGraph::eraseNode(), GUM_ERROR, and gum::ArcGraphPart::parents().
Referenced by __not_rec(), and __rec().
INLINE void gum::prm::gspan::Pattern::rightmostPath | ( | std::list< NodeId > & | r_path | ) | const |
Fill r_path with the rightmost path of this Pattern. The list is supposed empty.
Definition at line 153 of file pattern_inl.h.
References gum::ArcGraphPart::parents(), and size().
Referenced by __not_rec(), __rec(), and gum::prm::GSpan< GUM_SCALAR >::__subgraph_mining().
INLINE Size gum::prm::gspan::Pattern::size | ( | ) | const |
Returns the number of nodes in this Pattern.
Definition at line 147 of file pattern_inl.h.
References gum::NodeGraphPart::size().
Referenced by addNodeWithLabel(), Pattern(), and rightmostPath().
INLINE Size gum::prm::gspan::Pattern::sizeArcs | ( | ) | const |
Returns the number of arcs in this Pattern.
Definition at line 150 of file pattern_inl.h.
References gum::ArcGraphPart::sizeArcs().
|
inherited |
returns the number of nodes in the NodeGraphPart
Definition at line 280 of file nodeGraphPart_inl.h.
Referenced by gum::BinaryJoinTreeConverterDefault::__markConnectedComponent(), gum::BarrenNodesFinder::barrenNodes(), gum::BinaryJoinTreeConverterDefault::convert(), gum::EliminationSequenceStrategy::setGraph(), gum::MarkovBlanket::sizeNodes(), and gum::EssentialGraph::sizeNodes().
std::string gum::prm::gspan::Pattern::toDot | ( | size_t | name | ) | const |
Print the pattern in the DOT syntax.
Definition at line 86 of file pattern.cpp.
References arcs(), and label().
|
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.
Definition at line 68 of file diGraph.cpp.
References gum::ArcGraphPart::arcs(), and gum::NodeGraphPart::nodes().
The topological order stays the same as long as no variable or arcs are added or erased src the topology.
clear | If false returns the previously created topology. |
InvalidDirectedCycle | Raised if this DiGraph contains cycles. |
Definition at line 91 of file diGraph.cpp.
References gum::DiGraph::__mutableTopologicalOrder, gum::DiGraph::__topologicalOrder(), and gum::SequenceImplementation< Key, Alloc, Gen >::clear().
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__setO3ClassCreationOrder(), gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::__setO3InterfaceCreationOrder(), gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__setO3TypeCreationOrder(), gum::learning::Miic::learnStructure(), and gum::DAGmodel::topologicalOrder().
|
virtualinherited |
to friendly display the content of the graph
Reimplemented in gum::MixedGraph.
Definition at line 61 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 141 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__children, gum::Set< Key, Alloc >::beginSafe(), gum::ArcGraphPart::children(), gum::Set< Key, Alloc >::endSafe(), and gum::ArcGraphPart::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 129 of file arcGraphPart_inl.h.
References gum::ArcGraphPart::__parents, gum::Set< Key, Alloc >::beginSafe(), gum::Set< Key, Alloc >::endSafe(), gum::ArcGraphPart::eraseArc(), and gum::ArcGraphPart::parents().
Referenced by gum::DiGraph::eraseNode(), and gum::MixedGraph::eraseNode().
|
private |
Mapping between edges in this Pattern and their respective LabelData.
Definition at line 213 of file pattern.h.
Referenced by addArc(), edgeCode(), label(), and pop_back().
|
private |
|
private |
The last LabelData added to this pattern.
Definition at line 216 of file pattern.h.
Referenced by addNodeWithLabel(), and lastAdded().
|
private |
Mapping between nodes in this Pattern and their respective LabelData.
Definition at line 209 of file pattern.h.
Referenced by addArc(), addNodeWithLabel(), label(), pop_back(), and remove().
Definition at line 83 of file arcGraphPart.h.
Referenced by gum::ArcGraphPart::addArc(), gum::ArcGraphPart::ArcGraphPart(), and gum::ArcGraphPart::operator=().
Definition at line 84 of file arcGraphPart.h.
Referenced by gum::ArcGraphPart::clearArcs(), and gum::ArcGraphPart::eraseArc().
|
inherited |
Definition at line 274 of file nodeGraphPart.h.
Referenced by gum::NodeGraphPart::addNodeWithId().
|
inherited |
Definition at line 275 of file nodeGraphPart.h.
Referenced by gum::NodeGraphPart::__clearNodes().