BloombergLP::bdlb::TopologicalSortUtil::sort

sort overloads

Synopses

Declared in <bdlb_topologicalsortutil.h>

Sort nodes into topological order given edge relations.

template<class NODE_TYPE>
static
bool
sort(
    bsl::vector<NODE_TYPE>* result,
    bsl::vector<NODE_TYPE>* unsorted,
    bsl::vector<bsl::pair<NODE_TYPE, NODE_TYPE>> const& relations);
» more...

Sort input edges into topological order via output iterators.

template<
    class INPUT_ITER,
    class OUTPUT_ITER,
    class UNSORTED_OUTPUT_ITER>
static
bool
sort(
    INPUT_ITER relationsBegin,
    INPUT_ITER relationsEnd,
    OUTPUT_ITER resultOutIter,
    UNSORTED_OUTPUT_ITER unsortedOutIter);
» more...

Return Value

true if the sort succeeds, and false if a cycle is found

Parameters

NameDescription
resultdestination for the ordered nodes
unsorteddestination for nodes left unsorted on failure
relationsdirected edges (U, V) where U precedes V
relationsBeginbeginning of the input edge range
relationsEndend of the input edge range
resultOutIteroutput iterator for the ordered nodes
unsortedOutIteroutput iterator for unsorted nodes on failure