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

Function main

code/chapter08/graph_matrix.rs:63–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

add_edgeMethod · 0.45

Tested by

no test coverage detected