08-27-周三_17-09-29
This commit is contained in:
10
node_modules/graphlibrary/lib/alg/find-cycles.js
generated
vendored
Normal file
10
node_modules/graphlibrary/lib/alg/find-cycles.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
const _ = require('../lodash')
|
||||
const 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]))
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user