26 lines
748 B
Rust
26 lines
748 B
Rust
// ----------------------------------------------------------------
|
|
// IMPORTS
|
|
// ----------------------------------------------------------------
|
|
|
|
mod stacks;
|
|
mod core;
|
|
mod graphs;
|
|
|
|
use graphs::graph::Graph;
|
|
use graphs::tarjan::tarjan_algorithm;
|
|
|
|
// ----------------------------------------------------------------
|
|
// MAIN METHOD
|
|
// ----------------------------------------------------------------
|
|
|
|
fn main() {
|
|
let nodes: Vec<_> = vec![1,2,3,4,5,6,7];
|
|
let edges: Vec<(_, _)> = vec![(1,2), (1,3), (2,3), (3,4), (4,5), (5,2), (5,6), (5,7), (6,7)];
|
|
let gph = Graph::new(nodes, edges);
|
|
let components = tarjan_algorithm(&gph);
|
|
println!("Components:");
|
|
for component in components {
|
|
println!("{:?}", component);
|
|
}
|
|
}
|