-
Notifications
You must be signed in to change notification settings - Fork 185
Home
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.
- Usage
- Differences between the Python and JavaScript implementations (you should read this!)
- How to draw graphs
- Examples
You can download the latest version of JSNetworkX here:
or get the latest version and the source code:
The following libraries are used by JSNetworkX:
- Jasmine for testing
- Closure Library as base framework
- D3 for visualization
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
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.
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.
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.