...

/

Graphs (Implementation)

Graphs (Implementation)

add a vertex, add an edge, print graph (Reading time: under 3 minutes)

To implement a graph, we first create a class.

Press + to interact
class Graph {
constructor() {
this.numberOfVertices = 0;
this.adjList = new Map();
}
}

The matrix is going to be a JavaScript map object. ...

Access this course and 1400+ top-rated courses and projects.