Skip to content

Instantly share code, notes, and snippets.

@RelativeTech
Created July 7, 2021 19:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RelativeTech/95fd9b2285bdbd271708460e13188c91 to your computer and use it in GitHub Desktop.
Save RelativeTech/95fd9b2285bdbd271708460e13188c91 to your computer and use it in GitHub Desktop.
graph ads
class GraphNode {
constructor(val) {
this.val = val;
this.neighbors = [];
}
}
let a = new GraphNode("a");
let b = new GraphNode("b");
let c = new GraphNode("c");
let d = new GraphNode("d");
let e = new GraphNode("e");
let f = new GraphNode("f");
a.neighbors = [e, c, b];
c.neighbors = [b, d];
e.neighbors = [a];
f.neighbors = [e];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment