Skip to main content

Interactive network in d3js

Project description

Interactive network creator (d3graph)

PyPI Version License

d3graph is a python package that simplifies the task of creating interactive and stand-alone networks in d3 javascript using python. For this package I was inspired by various examples shown on the internet. But all of these examples are purely based on javascript without any easy python package to generate the networks. Therefore I decided to create a package that automatically creates d3js javascript and html code based on a input adjacency matrix in python! Huray!

This package provides functionality to create a interactive and stand-alone network that is build on d3 javascript. D3graph only requirs an adjacency matrix in the form of an pandas dataframe. Each column and index name represents a node whereas values >0 in the matrix represents an edge. Node links are build from rows to columns. Building the edges from row to columns only matters in directed cases. The network nodes and edges can be adjusted in weight, color etc, based on user defined paramters.



d3graph is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows. Note: d3graph requires networkx to be v2 or higher. It is distributed under the Apache 2.0 license. There are two ways to install d3graph:

  • Install d3graph from PyPI (recommended):
pip install d3graph
  • Install d3graph from the GitHub source:
git clone
cd d3graph
pip install "networkx>=2"
python install

Quick Start

In order to create an interactive and stand-alone d3graph, following workflow can be used:

  • Import d3graph method
from d3graph import d3graph
  • Create simple example dataset for which the input matrix should look this:

G = nx.karate_club_graph()
adjmat = nx.adjacency_matrix(G).todense()
adjmat = pd.DataFrame(index=range(0,adjmat.shape[0]), data=adjmat, columns=range(0,adjmat.shape[0]))
  • Make d3graph
G_d3   = d3graph(adjmat)

The output looks as below:



Please cite d3graph in your publications if this is useful for your research. Here is an example BibTeX entry:

  author={Erdogan Taskesen},


© Copyright

See LICENSE for details.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for d3graph, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size d3graph-0.1.3-py3-none-any.whl (94.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size d3graph-0.1.3.tar.gz (108.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page