114 INLINE std::optional< std::vector< NodeId > >
virtual void addArc(NodeId tail, NodeId head)
insert a new arc into the ArcGraphPart
bool operator==(const ArcGraphPart &p) const
tests whether two ArcGraphParts contain the same arcs
ArcGraphPart & operator=(const ArcGraphPart &s)
copy operator
void clearArcs()
removes all the arcs from the ArcGraphPart
void unvirtualizedEraseChildren(NodeId id)
same function as eraseChildren but without any virtual call to an erase
void unvirtualizedEraseParents(NodeId id)
same function as eraseParents but without any virtual call to an erase
NodeSet ancestors(NodeId id) const
returns the set of all ancestors of id (nodes from which id is reachable)
NodeSet family(NodeId id) const
returns { id } ∪ parents(id)
std::optional< std::vector< NodeId > > directedPath(NodeId node1, NodeId node2) const
returns a directed path from node1 to node2, or std::nullopt if none
DiGraph & operator=(const DiGraph &g)
copy operator
void clear() override
removes all the nodes and arcs from the graph
void addArc(const NodeId tail, const NodeId head) override
insert a new arc into the directed graph
NodeProperty< NodeId > connectedComponents() const
returns a property {node:id of weakly connected component}
DiGraph(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true)
default constructor
void eraseNode(const NodeId id) override
remove a node and its adjacent arcs from the graph
Sequence< NodeId > topologicalOrder() const
Build and return a topological order.
bool operator==(const DiGraph &g) const
tests whether two DiGraphs are identical (same nodes, same arcs)
NodeSet descendants(NodeId id) const
returns the set of all descendants of id (nodes reachable from id)
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
Exception : node does not exist.
virtual void eraseNode(const NodeId id)
erase the node with the given id
NodeGraphPart & operator=(const NodeGraphPart &p)
copy operator
bool exists(const NodeId id) const
alias for existsNode
virtual void clearNodes()
remove all the nodes from the NodeGraphPart
bool operator==(const NodeGraphPart &p) const
check whether two NodeGraphParts contain the same nodes
Generic cycle-detection algorithms for aGrUM graphs.
Base classes for oriented graphs.
#define GUM_ERROR(type, msg)
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
NodeSet descendants(const G &g, NodeId id)
Returns the set of all descendants of id (nodes reachable from id following arc direction).
NodeSet ancestors(const G &g, NodeId id)
Returns the set of all ancestors of id (nodes from which id is reachable following arc direction).
std::optional< std::vector< NodeId > > directedUnorientedPath(const G &g, NodeId n1, NodeId n2)
Shortest path from n1 to n2 ignoring arc orientation (BFS).
std::optional< std::vector< NodeId > > directedPath(const G &g, NodeId n1, NodeId n2)
Shortest directed path from n1 to n2 (BFS, arc direction).
NodeSet family(const G &g, NodeId id)
Returns the family of id : { id } ∪ parents(id).
NodeProperty< NodeId > connectedComponents(const G &g)
Returns a node-to-component-id mapping for the (weakly) connected components of g.
Sequence< NodeId > topologicalOrder(const G &g)
Returns a topological ordering of the nodes of g (Kahn's algorithm).
gum is the global namespace for all aGrUM entities
Generic BFS-based path-finding algorithms for aGrUM graphs.
Generic node-reachability algorithms for aGrUM graphs.