54#ifndef GUM_DAG_CYCLE_DETECTOR_H
55#define GUM_DAG_CYCLE_DETECTOR_H
348 Size multiplier) const;
353 Size multiplier) const;
360 const
NodeSet& extrmities) const;
A class for detecting directed cycles in DAGs when trying to apply many changes to the graph.
Base classes for directed acyclic graphs.
~ArcAdd() noexcept
destructor
ArcAdd & operator=(const ArcAdd &from) noexcept
copy operator
ArcAdd(NodeId tail, NodeId head) noexcept
default constructor
~ArcDel() noexcept
destructor
ArcDel(NodeId tail, NodeId head) noexcept
default constructor
ArcDel & operator=(const ArcDel &from) noexcept
copy operator
ArcReverse & operator=(const ArcReverse &from) noexcept
copy operator
~ArcReverse() noexcept
destructor
ArcReverse(NodeId tail, NodeId head) noexcept
default constructor
the base class indicating the possible changes
ChangeType type() const noexcept
returns the type of the operation
NodeId tail() const noexcept
indicates the tail of the arc involved in the modification
NodeId _head_
the head of the arc to be modified
Change & operator=(const Change &from) noexcept
virtual ~Change() noexcept
ChangeType _type_
the type of modification
Change(ChangeType type, NodeId tail, NodeId head) noexcept
NodeId _tail_
the tail of the arc to be modified
NodeId head() const noexcept
indicates the head of the arc involved in the modification
DAGCycleDetector() noexcept
default constructor
bool hasCycleFromModifications(const std::vector< Change > &modifs) const
indicates whether a set of modifications would create a cycle
bool hasCycleFromDeletion(NodeId x, NodeId y) const noexcept
indicates whether an arc deletion would create a cycle
NodeProperty< NodeProperty< Size > > _descendants_
the set of descendants of each node in the dag
void _addWeightedSet_(NodeProperty< Size > &nodeset, const NodeProperty< Size > &set_to_add, Size multiplier) const
adds a weighted nodeset to another (weights are added)
void addArc(NodeId x, NodeId y)
adds a new arc to the current DAG
void setDAG(const DAG &dag)
sets the initial DAG from which changes shall be applied
bool hasCycleFromReversal(NodeId x, NodeId y) const noexcept
indicates wether an arc reversal would create a cycle
NodeProperty< NodeProperty< Size > > _ancestors_
the set of ancestors of each node in the dag
void _delWeightedSet_(NodeProperty< Size > &nodeset, const NodeProperty< Size > &set_to_del, Size multiplier) const
removes a weighted nodeset from another (weights are subtracted)
void reverseArc(NodeId x, NodeId y)
reverses an arc from the DAG
void eraseArc(NodeId x, NodeId y)
removes an arc from the current DAG
DiGraph _dag_
the initial dag from which modifications are applied
void _restrictWeightedSet_(NodeProperty< Size > &result_set, const NodeProperty< Size > &set_to_restrict, const NodeSet &extrmities) const
put into a weighted nodeset the nodes of another weighted set that belong to a set of arc extremities
bool hasCycleFromAddition(NodeId x, NodeId y) const noexcept
indicates whether an arc addition would create a cycle
Base class for all oriented graphs.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size NodeId
Type for node ids.
HashTable< NodeId, VAL > NodeProperty
Property on graph elements.
Set< NodeId > NodeSet
Some typdefs and define for shortcuts ...
gum is the global namespace for all aGrUM entities