Skip to content

Instantly share code, notes, and snippets.

@burdenless
Created June 28, 2016 21:24
Show Gist options
  • Save burdenless/5703abb9be27b31a628aa3cfdbe5f472 to your computer and use it in GitHub Desktop.
Save burdenless/5703abb9be27b31a628aa3cfdbe5f472 to your computer and use it in GitHub Desktop.
Implementing Graph Theory in JS
var edgeList = [ [0, 2], [1, 3], [2, 3], [2, 4], [3, 5], [4, 5] ];
var adjMatrix = [
/*0*/[0, 0, 1, 0, 0, 0],
/*1*/[0, 0, 0, 1, 0, 0],
/*2*/[0, 0, 0, 1, 1, 0],
/*3*/[0, 0, 0, 0, 0, 1],
/*4*/[0, 0, 0, 0, 0, 1],
/*5*/[0, 0, 0, 0, 0, 0]
];
var adjList = [
/*0*/[2],
/*1*/[3],
/*2*/[3, 4],
/*3*/[5],
/*4*/[5],
/*5*/[]
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment