Innovenergy_trunk/frontend/node_modules/graphlib/lib/alg/find-cycles.js

11 lines
256 B
JavaScript

var _ = require("../lodash");
var tarjan = require("./tarjan");
module.exports = findCycles;
function findCycles(g) {
return _.filter(tarjan(g), function(cmpt) {
return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));
});
}