@not_implemented_for('directed')
@not_implemented_for('multigraph')
def communicability_exp(G):
 import scipy.linalg
 nodelist = list(G)
 A = nx.to_numpy_matrix(G, nodelist)
 A[(A != 0.0)] = 1
 expA = scipy.linalg.expm(A.A)
 mapping = dict(zip(nodelist, range(len(nodelist))))
 c = {}
 for u in G:
  c[u] = {}
  for v in G:
   c[u][v] = float(expA[(mapping[u], mapping[v])])
 return c

@ not_implemented_for ( 'directed' ) @ not_implemented_for ( 'multigraph' ) def communicability_exp ( G ) : import scipy . linalg nodelist = list ( G ) A = nx . to_numpy_matrix ( G , nodelist ) A [ ( A != 0.0 ) ] = 1 expA = scipy . linalg . expm ( A . A ) mapping = dict ( zip ( nodelist , range ( len ( nodelist ) ) ) ) c = { } for u in G : c [ u ] = { } for v in G : c [ u ] [ v ] = float ( expA [ ( mapping [ u ] , mapping [ v ] ) ] ) return c
return communicability between all pairs of nodes in g .