View source: R/topological_sort.R
| safe_topological_sort | R Documentation |
Calls topological_sort and falls back to elements in order of
first appearance if a cycle makes a valid ordering impossible. Guaranteed to
always return a character vector of all unique elements.
safe_topological_sort(
ordered_list,
priority = c("none", "lexicographic", "least_constrained", "most_constrained")
)
ordered_list |
A list of character vectors, each specifying a partial ordering of elements. Consecutive elements within a vector imply a precedence constraint: earlier elements must appear before later ones in the output. Elements may appear across multiple vectors; constraints from all vectors are combined. Duplicate constraints are silently ignored. |
priority |
A string controlling how ties are broken when multiple elements are simultaneously eligible for placement. One of:
|
A character vector of all unique elements from ordered_list.
If constraints are consistent, the order satisfies all precedence
constraints as per topological_sort. If a cycle is detected,
elements are returned in order of first appearance in ordered_list.
topological_sort
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.