Try out petgraph

This commit is contained in:
Joscha 2024-12-30 13:12:49 +01:00
parent e3e191b748
commit 34df6c9f14
6 changed files with 166 additions and 0 deletions

View file

@ -35,6 +35,14 @@ enum Command {
#[arg(short, long)]
flip: bool,
},
/// Find a path from one article to another.
PathPetgraph {
from: String,
to: String,
/// Flip start and end article.
#[arg(short, long)]
flip: bool,
},
/// Find the longest shortest path starting at an article.
LongestShortestPath { from: String },
/// Analyze articles using "Philosophy Game" rules.
@ -74,6 +82,13 @@ fn main() -> io::Result<()> {
commands::path::path(&args.datafile, &from, &to)
}
}
Command::PathPetgraph { from, to, flip } => {
if flip {
commands::path_petgraph::path(&args.datafile, &to, &from)
} else {
commands::path_petgraph::path(&args.datafile, &from, &to)
}
}
Command::LongestShortestPath { from } => {
commands::longest_shortest_path::run(&args.datafile, &from)
}