why cannot recalculate (2)?
html("<h1> From Dictionary to Matrix (2)</h1>")
@interact
def newtarph( D=input_box(default={0: {1: 2, 2: 3}, 1: {0: 3, 2: 4}, 2: {3: 2, 4: 1}, 3: {0: 2, 1: 3, 4: 1}}, label='Dictionary')):
G = DiGraph(D)
W= G.weighted_adjacency_matrix()
n=G.num_verts()
C=[(i,j) for (i,j) in CartesianProduct(range(n),range(n)) if (W[i][j]<>0)]
E0=matrix(C)
V=vector([W[i][j] for (i,j) in C])
E=column_matrix([E0.column(0),E0.column(1),V])
print E
In these form I can recalculate without problems