# generic-digraph

> a generic directed graph implementation

Latest version **3.1.2** (published 2019-07-25) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install generic-digraph
pnpm add generic-digraph
yarn add generic-digraph
bun add generic-digraph
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2019-07-25 |
| First published | 2016-02-08 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 129.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mjbecze |
| Maintainers | null_radix |
| Keywords | digraph, directed graph, garph |

## Links

- npm: https://www.npmjs.com/package/generic-digraph
- Repository: https://gitlab.com/mjbecze/generic-digraph
- Issues: https://gitlab.com/mjbecze/generic-digraph/issues
- npm.io page: https://npm.io/package/generic-digraph

## Alternatives

- [d3-force-3d](https://npm.io/package/d3-force-3d.md) — 1.0M weekly downloads
- [ng2-charts](https://npm.io/package/ng2-charts.md) — 486.8K weekly downloads
- [@arcgis/core](https://npm.io/package/@arcgis/core.md) — 257.8K weekly downloads
- [react-sparklines](https://npm.io/package/react-sparklines.md) — 249.3K weekly downloads
- [react-native-gifted-charts](https://npm.io/package/react-native-gifted-charts.md) — 182.3K weekly downloads

## Recent versions

- 3.1.2 (latest) — 2019-07-25
- 3.1.1 — 2016-07-14
- 3.1.0 — 2016-06-05
- 3.0.0 — 2016-03-31
- 2.5.0 — 2016-03-29
- 2.4.1 — 2016-03-28
- 2.4.0 — 2016-03-18
- 2.3.0 — 2016-02-27
- 2.2.0 — 2016-02-21
- 2.1.0 — 2016-02-18
- 2.0.1 — 2016-02-17
- 2.0.0 — 2016-02-17
- 1.0.1 — 2016-02-12
- 1.0.0 — 2016-02-11
- 0.0.2 — 2016-02-10
- … 2 more at https://npm.io/package/generic-digraph/versions

## README

# SYNOPSIS 
[![NPM Package](https://img.shields.io/npm/v/generic-digraph.svg?style=flat-square)](https://www.npmjs.org/package/generic-digraph)
[![Build Status](https://img.shields.io/travis/wanderer/generic-digraph.svg?branch=master&style=flat-square)](https://travis-ci.org/wanderer/generic-digraph)
[![Coverage Status](https://img.shields.io/coveralls/wanderer/generic-digraph.svg?style=flat-square)](https://coveralls.io/r/wanderer/generic-digraph)

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)  

This is a generic directional graph implementation. It makes use of ES6 iterators for graph traversal.

# USAGE

```javascript
const Digraph = require('generic-digraph')

// to start with the graph is just a single vertex
var vertex = new Digraph()

// now lets add an edge named 'friend' to the vertex with the value 'alice'
vertex.set('friend', 'alice')

vertex.set(['friend', 'brother'], 'bob')
// now the graph looks like:
// [vertex]---friend--->[alice]---brother-->[bob]

//path names and vertex values can be anything
vertex.set([new Buffer('friend'), 5, true, {}, new Date()], Array())

// edges are stored in a Map
vertex.edges // Map{}

// to get an array of all of the vertices
var vertices = [...vertex]

// you can also iterate a path
vertices = [...vertex.iteratePath(['friend', 'brother'])]

// getting a vertex works like setting
var friendsBotherVertex = vertex.set(['friend', 'brother'])
friendsBotherVertex.getValue() // "bob"

// delete an edge
vertex.del('friend')
// now the vertex is empty
vertex.isEmpty()
```

More Examples  
[./examples/](./examples)

# API

[./docs/](./docs/index.md)

### Notes on [iterate](https://github.com/wanderer/generic-digraph/blob/master/docs/index.md#iterate)

when decsending the graph, `accumulate`!  
when asecending the graph, `aggergate`!  

do you wish to not decsend futher?  
then using `continue`, do consider  
 
`accumlate`, `continue`, `aggergate`, repeat  
`accumlate`, `continue`, `aggergate`, repeat  


# EXTENDING
This was module was built so that it could be easly extended.

# LICENSE
[MPL-2.0](https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2))

---
_Source: https://npm.io/package/generic-digraph · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
