ads2_2022/code/rust/src/main.rs

26 lines
748 B
Rust
Raw Normal View History

2022-03-30 18:00:21 +02:00
// ----------------------------------------------------------------
// IMPORTS
// ----------------------------------------------------------------
2022-04-08 07:27:10 +02:00
mod stacks;
mod core;
mod graphs;
2022-03-30 18:00:21 +02:00
2022-04-08 07:27:10 +02:00
use graphs::graph::Graph;
use graphs::tarjan::tarjan_algorithm;
2022-03-30 18:00:21 +02:00
// ----------------------------------------------------------------
// MAIN METHOD
// ----------------------------------------------------------------
fn main() {
2022-04-08 07:27:10 +02:00
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);
}
2022-03-30 18:00:21 +02:00
}