dag-utils
v1.0.0
Published
DAG utils、isLoop(DFS)
Downloads
3
Readme
dag-utils
DAG 有向图判断是否有环的工具库,支持 commonjs、es6 module、umd browser
Installation
To install the package to your project, run:
$ npm install -S dag-utils
Usage
DFSIsLoop
深度优先遍历该图,如果在遍历的过程中,发现某个节点有一条边指向已经访问过的节点,则判断为有环
// commonjs
const DagUtils = require('dag-utils');
// es6 module
import DagUtils from 'dag-utils';
// umd browser
<script src="dist/dag-utils.umd.js">
DagUtils.DFSIsLoop(edges);
TopologyIsLoop
拓扑排序
// commonjs
const DagUtils = require('dag-utils');
// es6 module
import DagUtils from 'dag-utils';
// umd browser
<script src="dist/dag-utils.umd.js">
DagUtils.TopologyIsLoop(edges);