A graph in D3 and NetworkX can be represented as a JSON file.
Example:
```json
{
"nodes": [
{"id": 1, "name": "A"},
{"id": 2, "name": "B"},
{"id": 3, "name": "C"}
],
"links": [
{"source": 1,"target": 2},
{"source": 1,"target": 3}
]
}
```
The `nodes` entry in the JSON is a list containing a `node` object. Each `node` object has a unique id and a name which can appear inside the node in the drawing.
The `links` entry in the JSON is a list of `link` objects which each denote a (directed) edge between a source and target id.
To run the following script you'll need `graphwiz` installed on the system. You'll also need to have the python packages `networkx` and `pydot`.
```python
import networkx as nx
from networkx.readwrite import json_graph
from networkx.drawing.nx_pydot import graphviz_layout
import matplotlib.pyplot as plt
# Replace graph_json variable with JSON representation of graph