ngraph.sparse-collection

Subset of the University of Florida sparse matrix collection

npm install ngraph.sparse-collection
2 downloads in the last day
6 downloads in the last week
8 downloads in the last month

ngraph.sparse-collection

This repository is a subset of the University of Florida sparse matrix collection.

Each file in this repository has the following format:

// it can be consumed as common js module:
module.exports = { 
 "recordsPerEdge": 3,
 "links": [...],
 "description: "..."
};

links is a flat array of all links (edges) in the graph. Each link is represented by two or three numbers: fromId, toId and optionally associated data (when recordsPerEdge is 3);

Usage

This example shows how to transform a matrix into a graph:

// This collection is huge. Import concrete graph only
// to reduce amount of browserified package:
var mtxObject = require('ngraph.sparse-collection/HB/plat1919'),
    mtxParser = require('ngraph.serialization/mtx'),
    graph = mtxParser.loadFromObject(mtxObject);

// now you can use graph for analysis:
console.log(graph.getLinksCount());

How it's done

This collection was generated from public data set of University of Florida Sparse Matrix Collection. I've mounted image to ec2 host, and then with help of this 100 lines of code converted small subset of HB and LPnetlib folders into CommonJS module.

Caveat

Conversion itself is done with mtx parser. To save space this parser does not save loops (edges which start and end at the same vertex). Please let me know if it's a deal breaker - I'll make sure to fix this.

Citation

npm loves you