Ask Your Question
0

How to get only the connected graphs from this code

asked 2019-02-12 01:57:16 -0500

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 03:13:55 -0500

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 01:57:16 -0500

Seen: 26 times

Last updated: Feb 12