Package Exports
- dag-utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dag-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
dag-utils
DAG 有向图判断是否有环的工具库,支持 commonjs、es6 module、umd browser
Installation
To install the package to your project, run:
$ npm install -S dag-utilsUsage
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);