MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / createA

Function createA

easygraph/functions/basic/localassort.py:133–148  ·  view source on GitHub ↗

Create adjacency matrix and degree sequence.

(E, n, undir=True)

Source from the content-addressed store, hash-verified

131
132
133def createA(E, n, undir=True):
134 """Create adjacency matrix and degree sequence."""
135 if undir:
136 G = eg.Graph()
137 else:
138 G = eg.DiGraph()
139 G.add_nodes_from(range(n))
140
141 for e in E:
142 G.add_edge(e[0], e[1])
143
144 A = eg.to_scipy_sparse_matrix(G)
145
146 degree = np.array(A.sum(1)).flatten()
147
148 return A, degree
149
150
151def calculateRWRrange(W, i, alphas, n, maxIter=1000):

Callers 1

localAssortFunction · 0.85

Calls 4

add_nodes_fromMethod · 0.95
add_edgeMethod · 0.95
GraphMethod · 0.80
DiGraphMethod · 0.80

Tested by

no test coverage detected