MCPcopy Create free account
hub / github.com/GGA23/GrokFormer / normalize_graph

Function normalize_graph

preprocess_node_data.py:59–68  ·  view source on GitHub ↗
(g)

Source from the content-addressed store, hash-verified

57
58
59def normalize_graph(g):
60 g = np.array(g)
61 g = g + g.T
62 g[g > 0.] = 1.0
63 deg = g.sum(axis=1).reshape(-1)
64 deg[deg == 0.] = 1.0
65 deg = np.diag(deg ** -0.5)
66 adj = np.dot(np.dot(deg, g), deg)
67 L = np.eye(g.shape[0]) - adj
68 return L
69
70
71def eigen_decompositon(g):

Callers 2

eigen_decompositonFunction · 0.85
eigen_decompositon2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected