Crate szyk[][src]

Generic topological sort algorithm (depth-first)

Examples

    use szyk::*;

    let result = topsort_values(
        &[
            Node::new("wooden pickaxe", vec!["planks", "sticks"], "Pickaxe"),
            Node::new("planks", vec!["wood"], "Planks"),
            Node::new("sticks", vec!["planks"], "Sticks"),
            Node::new("wood", vec![], "Wood"),
        ],
        "wooden pickaxe",
    );
    assert_eq!(result, Ok(vec!["Wood", "Planks", "Sticks", "Pickaxe"]));

Structs

Node

Enums

TopsortError

Functions

topsort

calls cb with nodes from domain in topological order, ending on the node with id of target

topsort_values

returns values of nodes from domain in topological order, ending on the node with id of target