48 template < GUM_DiGraphable G >
57 for (
const auto par: g.parents(n)) {
60 next_frontier.insert(par);
64 for (
const auto chi: g.children(n)) {
67 next_frontier.insert(chi);
70 for (
const auto opar: g.parents(chi)) {
71 if (opar == n)
continue;
74 next_frontier.insert(opar);
85 for (
int lv = 1; lv < level && !frontier.
empty(); ++lv) {
87 for (
const auto n: frontier)
89 frontier = std::move(next);
bool existsArc(const Arc &arc) const
indicates whether a given arc exists
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
Exception: at least one argument passed to a function is not what was expected.
bool existsNode(const NodeId id) const
returns true iff the NodeGraphPart contains the given nodeId
virtual void addNodeWithId(const NodeId id)
try to insert a node with the given id
bool empty() const noexcept
Indicates whether the set is the empty set.
#define GUM_ERROR(type, msg)
Size NodeId
Type for node ids.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
Generic Markov-blanket algorithm for directed graphs.
DAG markovBlanket(const G &g, NodeId node, int level=1)
Returns the level-level Markov blanket of node in g as a DAG.