@types/toposort
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

Installation

npm install --save @types/toposort

Summary

This package contains type definitions for toposort (https://github.com/marcelklehr/toposort).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/toposort.

index.d.ts

/**
 * @param edges An array of directed edges describing a graph. An edge looks
 *              like this: `[node1, node2]` (vertices needn't be strings but can
 *              be of any type).
 * @returns a list of vertices, sorted from "start" to "end"
 * @throws if there are any cycles in the graph
 */
declare function toposort<T = string>(edges: ReadonlyArray<[T, T | undefined]>): T[];
declare namespace toposort {
    /**
     * This is a convenience method that allows you to define nodes that may or
     * may not be connected to any other nodes. The ordering of unconnected
     * nodes is not defined.
     * @param nodes An array of nodes
     * @param edges An array of directed edges. You don't need to mention all
     *              `nodes` here.
     * @returns a list of vertices, sorted from "start" to "end"
     * @throws if there are any cycles in the graph
     */
    function array<T = string>(
        nodes: readonly T[],
        edges: ReadonlyArray<[T, T | undefined]>,
    ): T[];
}
export = toposort;

Additional Details

  • Last updated: Mon, 20 Nov 2023 23:36:24 GMT
  • Dependencies: none

Credits

These definitions were written by Daniel Byrne, Prokop Simek, and Emily Marigold Klassen.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @types/toposort

Weekly Downloads

29,549

Version

2.0.7

License

MIT

Unpacked Size

5.02 kB

Total Files

5

Last publish

Collaborators

  • types