I am writing a program to plot a graph from a distance matrix. It is working fine. Now I want a certain node and a certain edge to be of a particular color of my choice. How do I do that?
The program is in Python and uses Networkx and Graphviz
import networkx as nx import numpy as np import pickle from random import randint p_file = open('pickles/distance') Dist = pickle.load(p_file) p_file.close() p_file = open('pickles/names') Names = pickle.load(p_file) p_file.close() dt = [('len', float)] A = np.array(Dist)*5 A = A.view(dt) G = nx.from_numpy_matrix(A) G = nx.relabel_nodes(G, dict(zip(range(len(G.nodes())),Names))) G = nx.to_agraph(G) G.node_attr.update(ndcolor="red", node="DC", style="filled") G.edge_attr.update(color="none") G.draw('P1.png', format='png', prog='neato') 