Ask Your Question
1

Error in finding cliques

asked 2021-06-22 17:44:12 +0200

bobby.mir gravatar image

I have the following code

f = open("42-matrix-of-size-378.txt", "r")
g = f.read()
l = g.split('-------------------------------')
matrix_list = {}
for i in range(0, 1):
    s = l[i].split()
    s.remove(s[0])
    A = matrix_maker(s)-matrix.identity(378)
    G=Graph(A, format='adjacency_matrix',loops=False)
    d = {i: [G.clique_number()]}
    matrix_list.update(d)
print(matrix_list)

But I got the following error:

the adjacency matrix of a non-weighted graph must have zeroes on the diagonal
edit retag flag offensive close merge delete

Comments

Could you please provide a way to fetch the 42-matrix-of-size-378.txt file so that we can see the actual issue ? If this is not possible, could you please provide a way to construct the matrix A ?

tmonteil gravatar imagetmonteil ( 2021-06-22 19:23:25 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-22 19:25:06 +0200

tmonteil gravatar image

Apparently, the matrix A has some nonezero entries along the diagonal, which is not allowed for adjacency matrices. We can not help much more than that until you provide more information to actually reproduce your situation.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-06-22 17:44:12 +0200

Seen: 129 times

Last updated: Jun 22 '21