Skip to content

Commit

Permalink
Added cdn link
Browse files Browse the repository at this point in the history
  • Loading branch information
anvaka committed Jul 26, 2020
1 parent 6f5c1f8 commit c17df5b
Show file tree
Hide file tree
Showing 5 changed files with 4,101 additions and 263 deletions.
38 changes: 24 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,44 @@ Load [dot](https://en.wikipedia.org/wiki/DOT_(graph_description_language)) files

# usage

``` javascript
var dot = require('ngraph.fromdot');
You can get the library from CDN:

``` html
<script src='https://cdn.jsdelivr.net/npm/ngraph.fromdot/dist/ngraph.fromDot.js'></script>
```

Or from npm:

```
npm install ngraph.fromdot
```

and then:

``` js
var fromDot = require('ngraph.fromdot');
```

After the library is loaded, it is straightforward to use:

``` js
// you can load empty graph:
var emptyGraph = dot('digraph G {}');
var emptyGraph = fromDot('digraph G {}');

// or graph with edges only:
var twoEdgesGraph = dot('digraph G { a -> b }');
var twoEdgesGraph = fromDot('digraph G { a -> b }');

// above graph is the same as
var sameAsAbove = dot('digraph G { a; b; a -> b }');
var sameAsAbove = fromDot('digraph G { a; b; a -> b }');

// you can also "append" to existing graph if you wish so:
dot('digraph B { a -> b }', emptyGraph);
fromDot('digraph B { a -> b }', emptyGraph);

// now emptyGraph is no longer empty:
emptyGraph.getLinksCount(); // returns 1
emptyGraph.getNodesCount(); // returns 2
```

# install

With [npm](https://npmjs.org) do:

```
npm install ngraph.fromdot
```

# license

MIT
Loading

0 comments on commit c17df5b

Please sign in to comment.