-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdraw_path_graph.rs
More file actions
23 lines (19 loc) · 728 Bytes
/
draw_path_graph.rs
File metadata and controls
23 lines (19 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use petgraph::dot::Dot;
use valley_free::{RelType, Topology};
fn main() {
let topo = Topology::from_edges(vec![
(1, 2, RelType::ProviderToCustomer),
(1, 3, RelType::ProviderToCustomer),
(2, 4, RelType::ProviderToCustomer),
(2, 5, RelType::ProviderToCustomer),
(2, 3, RelType::PeerToPeer),
(3, 5, RelType::ProviderToCustomer),
(3, 6, RelType::ProviderToCustomer),
]);
println!("Basic topology");
println!("{:?}", Dot::new(&topo.graph));
let topo_path = topo.valley_free_of(4);
println!("Path topology");
println!("{:?}", Dot::new(&topo_path.graph));
// You can visualize the graphs online at https://dreampuf.github.io/GraphvizOnline/
}