Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphlib

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphlib - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

CHANGELOG.md

5

index.js

@@ -1,3 +0,6 @@

exports.Graph = require("./lib/Graph");
exports.Digraph = require("./lib/Digraph");
exports.alg = require("./lib/alg");
exports.version = require("./lib/version");
// Backwards compatibility - to remove at next minor version bump
exports.Graph = exports.Digraph

8

lib/alg/isAcyclic.js

@@ -5,4 +5,8 @@ var topsort = require("./topsort");

// Given a Graph **g** this function returns `true` if the graph has no cycles
// and returns `false` if it does.
/*
* Given a Graph **g** this function returns `true` if the graph has no cycles
* and returns `false` if it does.
*
* @param {Graph} g the graph to test for cycles
*/
function isAcyclic(g) {

@@ -9,0 +13,0 @@ try {

module.exports = topsort;
topsort.CycleException = CycleException;
// Given a graph **g**, this function returns an ordered list of nodes such
// that for each edge `u -> v`, `u` appears before `v` in the list. If the
// graph has a cycle it is impossible to generate such a list and
// **CycleException** is thrown.
//
// See [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting)
// for more details about how this algorithm works.
/*
* Given a graph **g**, this function returns an ordered list of nodes such
* that for each edge `u -> v`, `u` appears before `v` in the list. If the
* graph has a cycle it is impossible to generate such a list and
* **CycleException** is thrown.
*
* See [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting)
* for more details about how this algorithm works.
*
* @param {Graph} g the graph to sort
*/
function topsort(g) {

@@ -12,0 +16,0 @@ var visited = {};

@@ -1,1 +0,1 @@

module.exports = '0.0.1';
module.exports = '0.0.3';
{
"name": "graphlib",
"version": "0.0.2",
"description": "A directed multi-graph library",
"version": "0.0.3",
"description": "A multi-graph library",
"main": "index.js",

@@ -12,3 +12,5 @@ "keywords": [

"chai": "1.7.x",
"dox-foundation": "~0.5.2",
"mocha": "1.12.x",
"semver": "2.1.x",
"uglify-js": "1.2.3"

@@ -15,0 +17,0 @@ },

# Graphlib
Graphlib is a JavaScript library that provides an implementation of a directed
Graphlib is a JavaScript library that provides an implementation of a
multi-graph. This library is used as part of the

@@ -12,2 +12,7 @@ [dagre](https://github.com/cpettitt/dagre) library, but is available here in a

Note that graphlib is current a pre-1.0.0 library. We will do our best to
maintain backwards compatibility, for patch level increases (e.g. 0.0.1 to
0.0.2) but make no claim to backwards compatibility across minor releases (e.g.
0.0.1 to 0.1.0). Watch our [CHANGELOG](CHANGELOG.md) for details on changes.
# Build / Install

@@ -21,14 +26,9 @@

# Use
# Example
Graphlib currently exports a single Graph object. The `graphlib.js` file includes
documentation for each of the functions on this Object.
Here we'll show a running example of the Graph API.
```js
var Graph = require("graphlib").Graph;
var Digraph = require("graphlib").Digraph;
// Create a new empty graph
var g = new Graph();
var g = new Digraph();

@@ -57,3 +57,3 @@ // Add node "A" to the graph with no value

// Add a directed edge with no ID (Graph will assign one) from "B" to "C"
// Add a directed edge with no ID (Diraph will assign one) from "B" to "C"
g.addEdge(null, "B", "C");

@@ -64,3 +64,3 @@

// Since Graph is a multi-graph, we can have multiple edges incident on the
// Since Digraph is a multi-graph, we can have multiple edges incident on the
// same source and target nodes.

@@ -88,6 +88,9 @@ g.addEdge("AB2", "A", "B");

```
There are a number of other functions for doing queries on `Graph` objects.
Please see `graphlib.js` which includes documentation for each of the
functions.
# API
[API documentation](http://cpettitt.github.io/project/graphlib/doc/index.html)
##
# License

@@ -94,0 +97,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc