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

27 lines (26 loc) 923 B
/** * This function performs a [postorder traversal][] of the graph `g` starting * at the nodes `vs`. For each node visited, `v`, the function `callback(v)` * is called. * * [postorder traversal]: https://en.wikipedia.org/wiki/Tree_traversal#Depth-first * * @example * * ![](https://github.com/dagrejs/graphlib/wiki/images/preorder.png) * * ```js * graphlib.alg.postorder(g, "A"); * // => One of: * // [ "B", "D", "E", C", "A" ] * // [ "B", "E", "D", C", "A" ] * // [ "D", "E", "C", B", "A" ] * // [ "E", "D", "C", B", "A" ] * ``` * * @param {Parameters<typeof dfs>[0]} g - The graph to traverse. * @param {Parameters<typeof dfs>[1]} vs - Nodes to start the traversal from. * @returns {ReturnType<typeof dfs>} The nodes in the order they were visited. */ export function postorder(g: Parameters<typeof dfs>[0], vs: Parameters<typeof dfs>[1]): ReturnType<typeof dfs>; import { dfs } from './dfs.js';