In [21]:
%matplotlib inline
In [22]:
import networkx as nx
import numpy as np
t1 = np.array([[1,3,1,1],[3,1,1,1],[1,1,1,1],[1,1,1,1]])
g = nx.to_networkx_graph(t1)
In [23]:
nx.draw(g)
In [24]:
t1
Out[24]:
In [25]:
g.add_node(4)
g.add_edge(1,4)
In [26]:
nx.draw(g)
In [27]:
m1 = nx.to_numpy_matrix(g)
print m1
In [28]:
g.remove_node(3)
In [29]:
nx.draw(g)
In [30]:
nx.to_numpy_matrix(g)
Out[30]:
In [31]:
m2 = nx.to_numpy_matrix(g)
In [32]:
print m2
In [34]:
g.
In [35]:
In [ ]: