6个版本 (3个稳定版本)

1.0.2 2021年4月16日
1.0.1 2021年4月7日
0.1.2 2021年4月4日

#2092 in 算法

Download history 4/week @ 2024-04-01 47/week @ 2024-04-15 10/week @ 2024-04-22 54/week @ 2024-04-29 163/week @ 2024-05-06 20/week @ 2024-05-13 14/week @ 2024-05-20 45/week @ 2024-05-27 2/week @ 2024-06-03 48/week @ 2024-06-10 66/week @ 2024-06-17 31/week @ 2024-06-24 48/week @ 2024-07-01 18/week @ 2024-07-08 16/week @ 2024-07-15

每月141次下载
用于 rustcbuildx

ISC许可证

8KB
147

szyk-rs

Rust的泛型拓扑排序

crates.io

示例

use szyk::Node;
use szyk;

let result = szyk::sort(
    &[
        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"]));

lib.rs:

泛型拓扑排序算法(深度优先)

示例

    use szyk::Node;
    use szyk;

    let result = szyk::sort(
        &[
            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"]));

无运行时依赖