|
| template<class To , class From > |
| static To * | assertedCast (From *value) |
| |
| template<typename... Args> |
| void | combineHashesWithSeed (std::size_t &seed, std::size_t hash, Args... args) |
| |
| template<typename... Args> |
| std::size_t | CombineHashes (std::size_t hash, Args... args) |
| |
| template<class T > |
| static constexpr int | log2Floor (T value) |
| |
| template<class T > |
| static constexpr T | RoundUpToPowerOf2 (T value) |
| |
| template<class T > |
| static constexpr T | RoundUpToMultipleOf (T value, T multiple) |
| |
| template<class T > |
| static constexpr int | BitsRequiredToRepresent (T value) |
| |
| template<class T > |
| static constexpr int | BitWidthOfEnum (T endValue) |
| |
| int | executeProgramAndWait (const std::string &programName, const std::vector< std::string > &programArguments) |
| |
| std::string | getDotViewer () |
| |
| static const util::BijectiveMap< Statistics::Id, std::string_view > & | GetStatisticsIdNames () |
| |
| std::string | CreateRandomAlphanumericString (std::size_t length) |
| |
| template<typename... Args> |
| static void | format_to_stream (std::ostream &os, Args... args) |
| |
| template<typename Arg > |
| static void | format_to_stream (std::ostream &os, const Arg &arg) |
| |
| template<typename Arg , typename... Args> |
| static void | format_to_stream (std::ostream &os, const Arg &arg, Args... args) |
| |
| template<typename... Args> |
| static std::string | strfmt (Args... args) |
| |
| template<typename NodeType , typename UnificationRootFunctor , typename SuccessorFunctor > |
| NodeType | FindStronglyConnectedComponents (NodeType numNodes, UnificationRootFunctor unificationRoot, SuccessorFunctor &successors, std::vector< NodeType > &sccIndex, std::vector< NodeType > &reverseTopologicalOrder) |
| |
| template<typename NodeType , typename SuccessorFunctor > |
| NodeType | FindStronglyConnectedComponents (NodeType numNodes, SuccessorFunctor &successors, std::vector< NodeType > &sccIndex, std::vector< NodeType > &reverseTopologicalOrder) |
| |
template<typename NodeType , typename SuccessorFunctor >
| NodeType jlm::util::FindStronglyConnectedComponents |
( |
NodeType |
numNodes, |
|
|
SuccessorFunctor & |
successors, |
|
|
std::vector< NodeType > & |
sccIndex, |
|
|
std::vector< NodeType > & |
reverseTopologicalOrder |
|
) |
| |
Implementation of Tarjan's algorithm for finding strongly connected components in linear time. This overload is for use cases where node unification is not used (every node is its own root). This means every node will be given an sccIndex, and all nodes will be included in the reverse topological order.
- See also
- FindStronglyConnectedComponents for details.
- Template Parameters
-
| NodeType | the integer type used to index nodes |
| SuccessorFunctor | a functor with the signature (NodeType) -> iterable<NodeType> |
- Parameters
-
| numNodes | the number of nodes, indexed from 0 to numNodes - 1. |
| successors | a function providing the targets of all outgoing edges from a given node. |
| sccIndex | output vector to be filled with the index of the SCC each node ends up in. |
| reverseTopologicalOrder | output vector filled with nodes in reverse topological order. |
- Returns
- the number of SCCs in the graph. One more than the largest SCC index
Definition at line 177 of file TarjanScc.hpp.
template<typename NodeType , typename UnificationRootFunctor , typename SuccessorFunctor >
| NodeType jlm::util::FindStronglyConnectedComponents |
( |
NodeType |
numNodes, |
|
|
UnificationRootFunctor |
unificationRoot, |
|
|
SuccessorFunctor & |
successors, |
|
|
std::vector< NodeType > & |
sccIndex, |
|
|
std::vector< NodeType > & |
reverseTopologicalOrder |
|
) |
| |
Implementation of Tarjan's algorithm for finding strongly connected components in linear time. Each node is assigned a strongly connected component (SCC), with SCC indices starting at 0. SCC indices are assigned such that, for each edge A -> B in the original graph, sccIndex[A] >= sccIndex[B]. They are equal iff A and B belong to the same SCC, i.e. the original graph contains a path from A to B, and from B to A.
In addition to assigning SCCs, a partial reverse topological ordering of nodes is returned. The ordering is a list of all root nodes, ordered by non-descending SCC index. Within a single SCC, the ordering of nodes is arbitrary.
This function also supports graphs where nodes have been unified. Within such a unification, one node is the root, while all other nodes are aliases for the root. The given unificationRoot function should return the root for any node. Only root nodes will be queried about their successors. Nodes that are not roots will not be given an sccIndex, and not be included in topological order.
- Template Parameters
-
| NodeType | the integer type used to index nodes |
| UnificationRootFunctor | a functor with the signature (NodeType) -> NodeType |
| SuccessorFunctor | a functor with the signature (NodeType) -> iterable<NodeType> |
- Parameters
-
| numNodes | the total number of nodes, including non-root nodes in unifications. Nodes are indexed from 0 to numNodes-1 |
| unificationRoot | an instance of the UnificationRootFunctor |
| successors | an instance of the SuccessorFunctor, returning outgoing edges from a root node. |
| sccIndex | output vector to be filled with the index of the SCC each node ends up in. Only nodes that are roots will be given an sccIndex. |
| reverseTopologicalOrder | output vector filled with root nodes in reverse topological order. In other words, a list of all root nodes, ordered with non-descending sccIndex. |
- Returns
- the number of SCCs in the graph. One more than the largest SCC index
Definition at line 52 of file TarjanScc.hpp.
template<class T >
| static constexpr T jlm::util::RoundUpToMultipleOf |
( |
T |
value, |
|
|
T |
multiple |
|
) |
| |
|
staticconstexpr |
Rounds the given value up to a multiple of multiple. The multiple must be a strictly positive integer.
Examples: RoundUpToMultipleOf(3, 5) = 5 RoundUpToMultipleOf(5, 5) = 5 RoundUpToMultipleOf(6, 5) = 10 RoundUpToMultipleOf(0, 5) = 0 RoundUpToMultipleOf(-11, 5) = -10
- Returns
- the result of rounding up, if value is not already a whole multiple
Definition at line 72 of file Math.hpp.