MCPcopy Create free account
hub / github.com/douchuan/algorithm / add_edge

Method add_edge

src/graph/undirected/graph.rs:58–65  ·  view source on GitHub ↗
(&mut self, v: usize, w: usize)

Source from the content-addressed store, hash-verified

56 }
57
58 fn add_edge(&mut self, v: usize, w: usize) {
59 // Algorithhms 4th Edition by Robert Sedgewick, Kevin Wayne
60 // p538, Adjacency-lists data structure
61 // first adjacent vertex in input is last on list
62 self.adj[v].push_front(w);
63 self.adj[w].push_front(v);
64 self.ne += 1;
65 }
66
67 fn adj(&self, v: usize) -> Iter<'_, usize> {
68 self.adj[v].iter()

Callers 2

fromMethod · 0.45
newMethod · 0.45

Calls 1

push_frontMethod · 0.80

Tested by

no test coverage detected