topSort
|
21 Feb 2014
|
Archive
Un-archive
|
var matrix2 = [ [0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,0,1,0,0,0,0]]; var matrix3 = [ [0,1,1,0,0], [0,0,1,0,0], [0,0,0,0,0], [0,0,1,0,1], [0,0,0,0,0]]; var matrix5 = [ [0,1,0,1,0,0], [0,0,1
|
11
|
21 Feb 2014
|
Archive
Un-archive
|
var matrix2 = [ [0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,0,1,0,0,0,0]]; var matrix3 = [ [0,1,1,0,0], [0,0,1,0,0], [0,0,0,0,0], [0,0,1,0,1], [0,0,0,0,0]]; var matrix5 = [ [0,1,0,1,0,0], [0,0,1
|
10
|
21 Feb 2014
|
Archive
Un-archive
|
var currMatrix = matrix3; function tops(matrix){ var noVisit = new Array(matrix.length); var array = [] ; for (var j = 0; j < matrix.length; j++) noVisit[j] = 0; for (var i = matrix.length-1; i > -1 ; i--) { if (noVisit[i] == 0) { var j = 0; // Go down ro
|
8
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
7
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
6
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
5
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
3
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
4
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
2
|
20 Feb 2014
|
Archive
Un-archive
|
var matrix1 = [[0,1,1,1,0,0,0], [0,0,1,0,0,1,0], [0,0,0,0,1,1,0], [0,0,0,0,1,0,1], [0,0,0,0,0,1,1], [0,0,0,0,0,0,1], [0,0,0,0,0,0,0]]; var matrix2 = [[0,1,1,0,0,0,0], [1,0,0,1,1,0,0], [1,0,0,0,1,1,1], [0,1,0,0,1,0,0], [0,1,1,1,0,0,0], [0,0,1,0,0,0,0], [0,
|
1
|
20 Feb 2014
|
Archive
Un-archive
|
Array.prototype.delete = function(index){ this.splice(index,1); }; function topsort(v){ // Find vertex with no outgoing edge // Assign this vertex |v| // delete this vertex from G, as well as all incoming edges // v-- // repeate } var matrix1 = [[0,1,1,1,
|
|