dagre-d3-es
Version:
<p align="center"> <a href="https://tbo47.github.io/" ><img src="https://img.shields.io/badge/created_by-tbo47-blue.svg" alt="Created by tbo47"></a> <a href="https://www.npmjs.com/dagre-d3-es"><img src="https://img.shields.io/npm/v/dagre-d3-es.svg?log
34 lines (33 loc) • 773 B
TypeScript
/**
* Given a Graph, `g`, this function returns `true` if the
* graph has no cycles and returns `false` if it does.
*
* @remarks
* This algorithm returns
* as soon as it detects the first cycle. You can use
* {@link ../findCycles} to get the actual list of cycles in the
* graph.
*
* @example
*
* ```js
* var g = new graphlib.Graph();
* g.setNode(1);
* g.setNode(2);
* g.setNode(3);
* g.setEdge(1, 2);
* g.setEdge(2, 3);
*
* graphlib.alg.isAcyclic(g);
* // => true
*
* g.setEdge(3, 1);
* graphlib.alg.isAcyclic(g);
* // => false
* ```
*
* @param {Graph} g - The graph to analyze.
* @returns {boolean} `true` if the graph is acyclic, `false` otherwise.
*/
export function isAcyclic(g: Graph): boolean;
import type { Graph } from '../graph.js';