MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / addEdge

Method addEdge

Data-Structures/Graph/Graph2.js:28–36  ·  view source on GitHub ↗
(v, w)

Source from the content-addressed store, hash-verified

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)) {

Callers

nothing calls this directly

Calls 2

pushMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected