File size: 257 Bytes
c211499
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import * as _ from 'lodash-es';
import { tarjan } from './tarjan.js';

export { findCycles };

function findCycles(g) {
  return _.filter(tarjan(g), function (cmpt) {
    return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));
  });
}