You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.7 KiB

4 months ago
import { GraphData } from './types';
declare const detectDirectedCycle: (graphData: GraphData) => {
[key: string]: string;
};
/**
* Base cycles
* refer: https://www.codeproject.com/Articles/1158232/Enumerating-All-Cycles-in-an-Undirected-Graph
* @param graph
* @param nodeIds ID
* @param include
* @return [{[key: string]: INode}] base cycles
*/
export declare const detectAllUndirectedCycle: (graphData: GraphData, nodeIds?: string[], include?: boolean) => any[];
/**
* Johnson's algorithm, O((V + E)(C + 1))$ and space bounded by O(V + E)
* refer: https://www.cs.tufts.edu/comp/150GA/homeworks/hw1/Johnson%2075.PDF
* refer: https://networkx.github.io/documentation/stable/_modules/networkx/algorithms/cycles.html#simple_cycles
* @param graph
* @param nodeIds ID
* @param include
* @return [{[key: string]: INode}] simple cycles
*/
export declare const detectAllDirectedCycle: (graphData: GraphData, nodeIds?: string[], include?: boolean) => any[];
/**
*
* @param graph
* @param directed
* @param nodeIds ID
* @param include
* @return [{[key: string]: Node}] Object表示key为节点idvalue为该节点在环中指向的下一个节点
*/
export declare const detectAllCycles: (graphData: GraphData, directed?: boolean, nodeIds?: string[], include?: boolean) => any[];
export default detectDirectedCycle;