@not_implemented_for('directed')
@not_implemented_for('multigraph')
def subgraph_centrality_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)
 sc = dict(zip(nodelist, map(float, expA.diagonal())))
 return sc

@ not_implemented_for ( 'directed' ) @ not_implemented_for ( 'multigraph' ) def subgraph_centrality_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 ) sc = dict ( zip ( nodelist , map ( float , expA . diagonal ( ) ) ) ) return sc
return the subgraph centrality for each node of g .