MCPcopy Index your code
hub / github.com/loiane/javascript-datastructures-algorithms / addVertex

Method addVertex

src/13-graph/graph.js:14–19  ·  view source on GitHub ↗
(vertex)

Source from the content-addressed store, hash-verified

12 }
13
14 addVertex(vertex) {
15 if (!this.#vertices.includes(vertex)) {
16 this.#vertices.push(vertex);
17 this.#adjList.set(vertex, []);
18 }
19 }
20
21 addEdge(vertex, edge) {
22 if (!this.#adjList.get(vertex)) {

Callers 9

addEdgeMethod · 0.95
buildSampleGraphFunction · 0.95
02-using-bfs.tsFile · 0.45
03-using-dfs.tsFile · 0.45
03-using-dfs.jsFile · 0.45
02-using-bfs.jsFile · 0.45
graph.test.tsFile · 0.45

Calls 2

setMethod · 0.80
pushMethod · 0.45

Tested by 1

buildSampleGraphFunction · 0.76