You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides a minimalist implementation of a directed graph data structure. Nodes are represented by unique strings. Internally, an [adjacency list](https://en.wikipedia.org/wiki/Adjacency_list) is used to represent nodes and edges.
9
10
10
11
The primary use case for this library is in implementing [dataflow programming](https://en.wikipedia.org/wiki/Dataflow_programming) or [reactive programming](https://en.wikipedia.org/wiki/Reactive_programming). The key algorithm necessary for these is topological sorting, to get an ordering of nodes such that for each edge (**u** -> **v**), **u** comes before **v** in the sorted order. The topological sorting algorithm exposed here has modifications useful for computing the order in which functions in a data flow graph should be executed, namely specifying source nodes for propagation and specifying to exclude the source nodes themselves from the result.
11
12
13
+
**Table of Contents**
14
+
15
+
*[Installing](#installing)
16
+
*[Examples](#examples)
17
+
*[ABC](#abc)
18
+
*[Getting Dressed](#getting-dressed)
19
+
*[API Reference](#api-reference)
20
+
21
+
## Installing
22
+
23
+
This library is distributed only via [NPM](npmjs.com). Install by running
24
+
25
+
`npm install graph-data-structure`
26
+
27
+
Require it in your code like this.
28
+
29
+
```javascript
30
+
var Graph =require("graph-data-structure");
31
+
```
32
+
33
+
## Examples
34
+
35
+
### ABC
36
+
12
37
To create a graph instance, invoke **[Graph](#graph)** as a constructor function.
13
38
14
39
```javascript
@@ -37,6 +62,8 @@ Now we have the following graph. <img src="https://cloud.githubusercontent.com/a
For more detailed example code that shows more methods, have a look at the [tests](https://github.com/datavis-tech/graph-data-structure/blob/master/test.js).
0 commit comments