Skip to content
fkling edited this page Sep 14, 2012 · 10 revisions

JSNetworkX is a port of NetworkX, a popular graph library for Python, to JavaScript.

JSNetworkX allows you to build, process and analyze graphs in JavaScript. It can be used together with D3.js in the browser to create interactive graph visualizations.

Resources

Installing

You can download the latest version of JSNetworkX here:

or get the latest version and the source code:

Development

The following libraries are used by JSNetworkX:

The Closure Compiler is used to minimize and optimize the code.

The development for JSNetworkX has just started, the rough roadmap is as follows:

  • Port unit tests to Jasmine (ongoing)
  • Port base classes (done)
  • Implement renderer with D3 (done, but subject to change)
  • Port algorithms module

Notes

The code is scattered with using bracket notation to access properties (foo['bar']) instead of dot notation (foo.bad). This is ugly, I know. But it is necessary to make the code work well with the Closure Compiler in advanced mode. This mode drastically reduces the file size.

Build instructions

To build the library on your own you will need ant. ant compile will download all necessary dependencies (Closure library and compiler) and compile the files.

Tests

You can run test either on the uncompiled or compiled code. For uncompiled code, simply run ant prepare.test, which will create a file SpecRunner.html that can be opened in the browser. prepare.test will run tools/test_collect.py which walks through the source and collect all test case files.

To run the compiled test you have to build a special test version with ant test_compile (which in turn calls ant prepare.test itself). It adds some helper functions and creates a more readable version of the compiled code.

Clone this wiki locally