I am trying to use pygraphviz and networkx in python (v 2.7) to create a network map. I found a script that looks very useful on stackoverflow:
import networkx as nx
import numpy as np
import string
import pygraphviz
dt = [('len', float)]
A = np.array([(0, 0.3, 0.4, 0.7),
(0.3, 0, 0.9, 0.2),
(0.4, 0.9, 0, 0.1),
(0.7, 0.2, 0.1, 0)
])*10
A = A.view(dt)
G = nx.from_numpy_matrix(A)
G = nx.relabel_nodes(G, dict(zip(range(len(G.nodes())),string.ascii_uppercase)))
G = nx.to_agraph(G)
G.node_attr.update(color="red", style="filled")
G.edge_attr.update(color="blue", width="2.0")
G.draw('/tmp/out.png', format='png', prog='neato')
I get an error on the last line, basically it cannot find neato:
"ValueError: Program neato not found in path."
The error refers to the agraph.py file for pygraphviz
, but I cannot see anything that could be causing the problem when I look through agraph.py
Any ideas how to resolve this? I am using windows and IDLE for my coding. Thanks!