D3 JavaScript networkx Graphs in Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
NetworkxD3 Fixed ipython notebook/added HTML iFrame of Net.html Dec 26, 2015
docs
.gitignore
Net.html
NetworkxD3example.ipynb
README.md Update README.md Oct 5, 2017
setup.py

README.md

NetworkxD3

D3 JavaScript networkx Graphs

Janu Verma

This is an python high-level interface to Christopher Gandrud's R package networkD3. It renders networkx graphs into HTML page containing a beautiful D3 visualization. Hence the name networkxD3 (shamelessly ripped from the original package networkD3), notice the x.

Requirements

  • python and R both installed on the system.
  • rpy2
  • pandas
  • networkx

Install

python setup.py install

Usage

import networkx as nx
from NetworkxD3 import simpleNetworkx

G = nx.Graph()
H = ["A","B","C","D","E","F","G", "H","I","J"]
G.add_nodes_from(H)
G.add_edges_from([("A","B"), ("A","C"), ("A","D"), ("A","J"), ("B","E"), ("B","F"),
("C","G"),("C","H"), ("D","I")])
  
simpleNetworkx(G)

This will create an HTML page Net.html which contains the interactive plot.

For a quick introduction to rpy2, check out this post on my blog.