First time here? Check out the FAQ!

Ask Your Question
1

Error in finding cliques

asked 3 years ago

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
Preview: (hide)

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 ( 3 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 3 years ago

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.

Preview: (hide)
link

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: 3 years ago

Seen: 201 times

Last updated: Jun 22 '21