Skip to main content

topological_sort

Function topological_sort 

Source
pub fn topological_sort(
    graph: &dyn GraphBackend,
) -> Result<Vec<i64>, SqliteGraphError>
Expand description

Performs topological sort using Kahn’s algorithm.

Backend-agnostic version using GraphBackend trait. Uses all_entity_ids() and fetch_outgoing()/fetch_incoming() trait methods.

§Arguments

  • graph - Any backend implementing GraphBackend trait

§Returns

Sorted vector of node IDs, or error if cycle detected.