MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / main

Function main

publication/code/chapter09/graph_matrix.rs:65–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63}
64
65fn main() {
66 let mut g = Graph::new(4);
67 let n1 = Vertex::new(0, "n1");
68 let n2 = Vertex::new(1, "n2");
69 let n3 = Vertex::new(2, "n3");
70 let n4 = Vertex::new(3, "n4");
71
72 g.add_edge(&n1,&n2); g.add_edge(&n1,&n3);
73 g.add_edge(&n2,&n3); g.add_edge(&n2,&n4);
74 g.add_edge(&n3,&n4); g.add_edge(&n3,&n1);
75
76 println!("{:#?}", g);
77 println!("graph empty: {}", g.is_empty());
78 println!("graph nodes: {}", g.len());
79}

Callers

nothing calls this directly

Calls 1

add_edgeMethod · 0.45

Tested by

no test coverage detected