Try out petgraph
This commit is contained in:
parent
e3e191b748
commit
34df6c9f14
6 changed files with 166 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue