MCPcopy Create free account
hub / github.com/TheAlgorithms/Rust / topological_sort

Function topological_sort

src/graph/topological_sort.rs:16–66  ·  view source on GitHub ↗

Given a directed graph, modeled as a list of edges from source to destination Uses Kahn's algorithm to either: return the topological sort of the graph or detect if there's any cycle

(
    edges: &Vec<(Node, Node)>,
)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 3

it_worksFunction · 0.85
test_wikipedia_exampleFunction · 0.85
test_cyclic_graphFunction · 0.85

Calls 4

pushMethod · 0.80
removeMethod · 0.45
getMethod · 0.45
is_emptyMethod · 0.45

Tested by 3

it_worksFunction · 0.68
test_wikipedia_exampleFunction · 0.68
test_cyclic_graphFunction · 0.68