Skip to content

anvaka/ngraph.toedgelist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ngraph.toedgelist Build Status

Save ngraph.graph into edge list.

usage

// let's say your graph has three edges:
var graph = require('ngraph.graph')();
graph.addLink(1, 2);
graph.addLink(1, 3);
graph.addLink(2, 4);

var toEdgeList = require('ngraph.toedgelist');
var edgeList = toEdgeList(graph);

Now edgeList is equal to [ [ 1, 2 ], [ 1, 3 ], [ 2, 4 ] ].

Edge list as a string

You can also save edge list as string:

var str = toEdgeList.asString(graph);

The str variable is now equal to:

# generated by ngraph.toedgelist
# Nodes: 4
# Edges: 3
# FromId	ToId
1	2
1	3
2	4

install

With npm do:

npm install ngraph.toedgelist

license

MIT

About

Save ngraph.graph into edge list

Resources

License

Stars

Watchers

Forks

Packages

No packages published