In [59]:
%matplotlib inline
from __future__ import division
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
In [38]:
P = np.array([[0.2, 0.5, 0.2],
[0, 0.5, 0.5],
[0, 0, 1]])
G=nx.from_numpy_matrix(P,create_using=nx.MultiDiGraph())
In [55]:
G.edges(data=True)
#pos = nx.random_layout(G)
#nx.draw_networkx_edge_labels(G)
#labels = {i : i + 1 for i in G.nodes()}
labels={}
labels[0]='good'
labels[1]='mediocre'
labels[2]='bad'
nx.draw_networkx_labels(G, pos, labels=labels, font_size=16)
#nx.write_dot(G,'G.dot')
Out[55]:
In [48]:
!neato -T png G.dot > multi.png
In [35]:
dt=[('good',float),('mediocre',float), ('bad', float)]
A=np.matrix([[(0.2, 0.5, 0.2)],
[(0, 0.5, 0.5)],
[(0, 0, 1)]], dtype=dt)
In [37]:
G=nx.from_numpy_matrix(A)
In [1]:
In [5]:
In [6]:
nx.write_dot(G,'G.dot')
In [7]:
!neato -T png G.dot > multi.png
In [ ]:
In [ ]: