Ask Your Question
0

How to get only the connected graphs from this code

asked 2019-02-12 08:57:16 +0100

anonymous user

Anonymous

how to get only the connected graphs from this code.

for G in graphs(10):

G.show()

L=G.laplacian_matrix().eigenvalues()

L.sort()

show(L)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-12 10:13:55 +0100

rburing gravatar image

You can replace graphs(10) by

filter(lambda g: g.is_connected(), graphs(10))

It is more efficient to use the nauty backend; replace graphs(10) by

graphs.nauty_geng('10 -c')
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

1 follower

Stats

Asked: 2019-02-12 08:57:16 +0100

Seen: 119 times

Last updated: Feb 12 '19