项目作者: Jverma

项目描述 :
D3 JavaScript networkx Graphs in Python
高级语言: HTML
项目地址: git://github.com/Jverma/NetworkxD3.git
创建时间: 2015-06-18T02:40:04Z
项目社区:https://github.com/Jverma/NetworkxD3

开源协议:

下载


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

  1. python setup.py install

Usage

  1. import networkx as nx
  2. from NetworkxD3 import simpleNetworkx
  3. G = nx.Graph()
  4. H = ["A","B","C","D","E","F","G", "H","I","J"]
  5. G.add_nodes_from(H)
  6. G.add_edges_from([("A","B"), ("A","C"), ("A","D"), ("A","J"), ("B","E"), ("B","F"),
  7. ("C","G"),("C","H"), ("D","I")])
  8. 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.