This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Graph() { | |
this.nodes = []; | |
this.arrows = new Map(); | |
} | |
// Tarjan's strongly connected components algorithm | |
Graph.prototype.stronglyConnectedComponents = function tarjan() { | |
var index = 0; | |
var stack = []; | |
var result = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const recast = require('recast'); | |
const types = require('ast-types'); | |
const n = types.namedTypes; | |
const b = types.builders; | |
const filePath = process.argv[2]; | |
const source = fs.readFileSync(filePath); | |
const ast = recast.parse(source); |
OlderNewer