🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

directed-graph

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directed-graph - npm Package Compare versions

Comparing version
1.0.1
to
1.0.2
+2
-2
package.json
{
"name": "directed-graph",
"version": "1.0.1",
"version": "1.0.2",
"description": "node package for weighted directed graphs",
"main": "src",
"main": "src/graph.js",
"scripts": {

@@ -7,0 +7,0 @@ "test": "mocha test"

@@ -1,10 +0,46 @@

graph.js
========
directed-graph
==============
node package for weighted directed graphs
###Installation
###Running Tests
`npm install directed-graph --save`
##Quickstart
```javascript
var Graph = require('directed-graph');
// Either initialize and fill an empty graph
var graphA = new Graph();
graphA.addVertex('A');
graphA.addVertex('B');
graphA.addVertex('C');
graphA.addEdge('A', 'B');
graphA.addEdge('A', 'C');
graphA.addEdge('B', 'A');
graphA.addEdge('B', 'C');
graphA.addEdge('C', 'A');
graphA.addEdge('C', 'B');
// Or predefine a new graph
var graphB = new Graph({
'A': ['B', 'C'],
'B': ['A', 'C'],
'C': ['A', 'B'],
});
// Both graphA and graphB function the same
graphA.setWeight('A', 'B', 10);
graphA.setWeight('B', 'A', 10);
graphA.addVertex('D');
graphA.addEdge('A', 'D');
console.log(graphA.pathExists('B', 'D'));
```
##Running Tests
Make sure to have mocha installed: `npm install -g mocha`
In project root directory, run: `mocha test`