65 marks_(std::move(other.marks_)) {
82 marks_ = std::move(other.marks_);
186 const NodeId x = e.first();
187 const NodeId y = e.second();
190 if (xArrow && yArrow) {
216 std::ostringstream s;
220 if (!first) { s <<
", "; }
222 const NodeId x = e.first();
223 const NodeId y = e.second();
224 s << std::format(
"{} {}--{} {}", x, markChar(
markAt(y, x)), markChar(
markAt(x, y)), y);
231 std::ostringstream out;
232 out <<
"digraph PAG {\n";
233 out <<
" node [shape=ellipse];\n";
240 const NodeId x = e.first();
241 const NodeId y = e.second();
244 const bool xCircle =
isCircle(y, x);
245 const bool yCircle =
isCircle(x, y);
247 const std::string arrowhead = yArrow ?
"normal" : (yCircle ?
"odot" :
"none");
248 const std::string arrowtail = xArrow ?
"normal" : (xCircle ?
"odot" :
"none");
250 out << std::format(
" {} -> {} [dir=both, arrowhead={}, arrowtail={}];\n",
Partial Ancestral Graph (PAG) — graph type for FCI output.
The base class for all directed edges.
void addArc(const NodeId tail, const NodeId head) override
insert a new arc into the directed graph
virtual void eraseEdge(const Edge &edge)
removes an edge from the EdgeGraphPart
const EdgeSet & edges() const
returns the set of edges stored within the EdgeGraphPart
virtual void clearEdges()
removes all the edges from the EdgeGraphPart
bool existsEdge(const Edge &edge) const
indicates whether a given edge exists
const NodeSet & neighbours(NodeId id) const
returns the set of node neighbours to a given node
The base class for all undirected edges.
GUM_NODISCARD NodeId first() const
returns one extremal node ID (whichever one it is is unspecified)
GUM_NODISCARD NodeId second() const
returns the node ID of the other extremal node ID
Base class for mixed graphs.
Class for node sets in graph.
const NodeGraphPart & nodes() const
return *this as a NodeGraphPart
virtual std::string toString() const
a function to display the set of nodes
std::string dotNodeLabel(NodeId id) const
returns " [label=\"...\"]" with DOT-escaped name, or "" if no name
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
Partial Ancestral Graph: undirected topology with endpoint marks.
bool isCircle(NodeId src, NodeId dst) const
true if mark at dst (from src) is Circle
bool isBidirected(NodeId x, NodeId y) const
true if edge x-y is bidirected x↔y (Arrowhead on both endpoints)
bool isDefCollider(NodeId x, NodeId z, NodeId y) const
true if z is a definite collider on path x-z-y (Arrowhead at z from both sides)
PAG & operator=(const PAG &)
void clear() override
remove all nodes, edges, and marks
void reorientAllWith(EdgeMark m)
set all endpoint marks to m (used between FCI phases to reset to Circle)
ArcProperty< EdgeMark > marks_
marks_[Arc(x,y)] = mark at y-endpoint of edge x-y
void addEdge(NodeId x, NodeId y) override
add edge with Circle-Circle marks
void setMarkAt(NodeId src, NodeId dst, EdgeMark m)
set mark at dst-endpoint when traversing from src
bool isTail(NodeId src, NodeId dst) const
true if mark at dst (from src) is Tail
void eraseEdge(const Edge &e) override
remove edge and its two mark entries
EdgeMark markAt(NodeId src, NodeId dst) const
mark at dst-endpoint when traversing from src
std::string toDot() const override
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; ...
void clearEdges() override
clear all edges (and their marks)
bool isArrowhead(NodeId src, NodeId dst) const
true if mark at dst (from src) is Arrowhead
MixedGraph toMixedGraph() const
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; ...
bool isDefinitelyDirected(NodeId x, NodeId y) const
true if edge x-y is definitely directed x→y (Tail@x, Arrowhead@y)
void eraseNode(NodeId id) override
remove node and clean up marks for all its adjacent edges
std::string toString() const override
approximate conversion for learnDAG/learnPDAG: Tail-Arrowhead → arc; Arrowhead-Arrowhead → two arcs; ...
UndiGraph & operator=(const UndiGraph &g)
copy operator
void clear() override
removes all the nodes and edges from the graph
void addEdge(NodeId first, NodeId second) override
insert a new edge into the undirected graph
void eraseNode(NodeId id) override
remove a node and its adjacent edges from the graph
UndiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size edges_size=HashTableConst::default_size, bool edges_resize_policy=true)
default constructor
Size NodeId
Type for node ids.
gum is the global namespace for all aGrUM entities
std::ostream & operator<<(std::ostream &stream, const AVLTree< Val, Cmp > &tree)
display the content of a tree
EdgeMark
Endpoint marks used in PAG edges.