UNPKG

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

15 lines (14 loc) 730 B
/** * A helper that preforms a pre- or post-order traversal on the input graph * and returns the nodes in the order they were visited. If the graph is * undirected then this algorithm will navigate using neighbors. If the graph * is directed then this algorithm will navigate using successors. * * @param {Graph} g - Input graph. * @param {NodeID[] | NodeID} vs - Starting node or array of nodes. * @param {'post' | 'pre'} order - The order to use. Must be one of "pre" or "post". * @returns {NodeID[]} The nodes in the order they were visited. */ export function dfs(g: Graph, vs: NodeID[] | NodeID, order: "post" | "pre"): NodeID[]; import type { Graph } from '../graph.js'; import type { NodeID } from '../graph.js';