Spaces:
Sleeping
Sleeping
|
Download frontend/node_modules/@rtsao/scc/README.md from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40rtsao/scc/README.md
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/@rtsao/scc/README.md
-
curl -L -o README.md https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/c9f908872ebbec3c4fa1392419c0f6cd3750ddb3/frontend/node_modules/%40rtsao/scc/README.md
1.1 kB
| # `@rtsao/scc` | |
| Find strongly connected components of a directed graph using [Tarjan's algorithm](https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm). | |
| This algorithm efficiently yields both a topological order and list of any cycles. | |
| ## Installation | |
| ``` | |
| yarn add @rtsao/scc | |
| ``` | |
| ``` | |
| npm install @rtsao/scc | |
| ``` | |
| ## Usage | |
| ```js | |
| const scc = require("@rtsao/scc"); | |
| const digraph = new Map([ | |
| ["a", new Set(["c", "d"])], | |
| ["b", new Set(["a"])], | |
| ["c", new Set(["b"])], | |
| ["d", new Set(["e"])], | |
| ["e", new Set()] | |
| ]); | |
| const components = scc(digraph); | |
| // [ Set { 'e' }, Set { 'd' }, Set { 'b', 'c', 'a' } ] | |
| ``` | |
| #### Illustration of example input digraph | |
| ``` | |
| βββββ βββββ | |
| β d β βββ β a β ββ | |
| βββββ βββββ β | |
| β β β | |
| βΌ βΌ β | |
| βββββ βββββ β | |
| β e β β c β β | |
| βββββ βββββ β | |
| β β | |
| βΌ β | |
| βββββ β | |
| β b β ββ | |
| βββββ | |
| ``` | |