import numpy as np

G = [
    [1,3,5,7],
    [2,4,6,8],
    [0,4,5,8],
    [2,1,6,7],
    [3,0,5,8],
    [1,3,6,7],
    [0,2,4,8],
    [2,6,5,1],
    [0,3,4,7],
]

n = 9
M = np.zeros((n,n))

for i in range(n):
    for j in G[i]:
        M[i][j] = 1
        M[j][i] = -1

# 固有ベクトルで強さっぽいものを見る
w, v = np.linalg.eig(M)
print(v[:,0])

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: