(v, w)
| 26 | |
| 27 | // add edge to the graph |
| 28 | addEdge(v, w) { |
| 29 | // get the list for vertex v and put the |
| 30 | // vertex w denoting edge between v and w |
| 31 | this.AdjList.get(v).push(w) |
| 32 | |
| 33 | // Since graph is undirected, |
| 34 | // add an edge from w to v also |
| 35 | this.AdjList.get(w).push(v) |
| 36 | } |
| 37 | |
| 38 | // Prints the vertex and adjacency list |
| 39 | printGraph(output = (value) => console.log(value)) { |