Save current BZZZ config-ui state before CHORUS branding update
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
21
install/config-ui/node_modules/@rtsao/scc/LICENSE
generated
vendored
Normal file
21
install/config-ui/node_modules/@rtsao/scc/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Ryan Tsao
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
49
install/config-ui/node_modules/@rtsao/scc/README.md
generated
vendored
Normal file
49
install/config-ui/node_modules/@rtsao/scc/README.md
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# `@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 │ ─┘
|
||||
└───┘
|
||||
```
|
||||
1
install/config-ui/node_modules/@rtsao/scc/index.d.ts
generated
vendored
Normal file
1
install/config-ui/node_modules/@rtsao/scc/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function tarjan<T>(graph: Map<T, Set<T>>): Array<Set<T>>
|
||||
51
install/config-ui/node_modules/@rtsao/scc/index.js
generated
vendored
Normal file
51
install/config-ui/node_modules/@rtsao/scc/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = tarjan;
|
||||
|
||||
// Adapted from https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm#The_algorithm_in_pseudocode
|
||||
|
||||
function tarjan(graph) {
|
||||
const indices = new Map();
|
||||
const lowlinks = new Map();
|
||||
const onStack = new Set();
|
||||
const stack = [];
|
||||
const scc = [];
|
||||
let idx = 0;
|
||||
|
||||
function strongConnect(v) {
|
||||
indices.set(v, idx);
|
||||
lowlinks.set(v, idx);
|
||||
idx++;
|
||||
stack.push(v);
|
||||
onStack.add(v);
|
||||
|
||||
const deps = graph.get(v);
|
||||
for (const dep of deps) {
|
||||
if (!indices.has(dep)) {
|
||||
strongConnect(dep);
|
||||
lowlinks.set(v, Math.min(lowlinks.get(v), lowlinks.get(dep)));
|
||||
} else if (onStack.has(dep)) {
|
||||
lowlinks.set(v, Math.min(lowlinks.get(v), indices.get(dep)));
|
||||
}
|
||||
}
|
||||
|
||||
if (lowlinks.get(v) === indices.get(v)) {
|
||||
const vertices = new Set();
|
||||
let w = null;
|
||||
while (v !== w) {
|
||||
w = stack.pop();
|
||||
onStack.delete(w);
|
||||
vertices.add(w);
|
||||
}
|
||||
scc.push(vertices);
|
||||
}
|
||||
}
|
||||
|
||||
for (const v of graph.keys()) {
|
||||
if (!indices.has(v)) {
|
||||
strongConnect(v);
|
||||
}
|
||||
}
|
||||
|
||||
return scc;
|
||||
}
|
||||
5
install/config-ui/node_modules/@rtsao/scc/index.js.flow
generated
vendored
Normal file
5
install/config-ui/node_modules/@rtsao/scc/index.js.flow
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// @flow
|
||||
|
||||
declare function tarjan<T>(graph: Map<T, Set<T>>): Array<Set<T>>;
|
||||
|
||||
declare module.exports: typeof tarjan;
|
||||
7
install/config-ui/node_modules/@rtsao/scc/package.json
generated
vendored
Normal file
7
install/config-ui/node_modules/@rtsao/scc/package.json
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "@rtsao/scc",
|
||||
"version": "1.1.0",
|
||||
"repository": "rtsao/scc",
|
||||
"main": "index.js",
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user