Ask Your Question
1

How to obtain the graph having highest algebraic connectivity?

asked 2020-06-24 15:24:16 -0500

Kuldeep gravatar image

for G in graphs.nauty_geng("10-c"):

if G.size()==11:

L = G.laplacian_matrix().eigenvalues()

L.sort()

show(L)

G.show()

Using this code I have obtained the connected graphs on 10 vertices with 11 edges. Also I have obtained the Laplacian eigenvalues also for the corresponding graphs. The second smallest eigenvalue of Laplacian matrix is called the algebraic connectivity. Now among all these graphs, I need those graphs which have highest algebraic connectivity among all the graphs on 10 vertices with 11 edges. How we can do that?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-06-24 15:43:15 -0500

rburing gravatar image

It is just like last year:

algebraic_connectivity = lambda g: sorted(g.laplacian_matrix().eigenvalues())[1]
G = max(graphs.nauty_geng("10 11:11 -c"), key=algebraic_connectivity)
G

image description

Here I also used nauty to restrict the number of edges to 11, for efficiency.

Of course there could be more than one such graph. Indeed, using the code from the old answer, the output is:

There are 2 graphs of (maximal) algebraic connectivity 1

image description image description

edit flag offensive delete link more

Comments

Ok. Thanks a lot for your answer.

Kuldeep gravatar imageKuldeep ( 2020-06-24 15:47:50 -0500 )edit

If possible, would you please give the whole code here so that I can obtain the two graphs. Thank you.

Kuldeep gravatar imageKuldeep ( 2020-06-24 16:00:23 -0500 )edit

@Kuldeep You're welcome. In the old code, just put my_graphs = graphs.nauty_geng("10 11:11 -c") at the top, and replace print ... by print(...) (we need parentheses in now, in Python 3).

rburing gravatar imagerburing ( 2020-06-24 16:05:35 -0500 )edit

ok. I Have got it now. Thank you so much.

Kuldeep gravatar imageKuldeep ( 2020-06-24 16:10:56 -0500 )edit
1

Now, if we run the same coder for 8 vertices and 9 edges, we should get three graphs having algebraic connectivity=1. But I am getting only 2. Where is the fault. will you please help?

Kuldeep gravatar imageKuldeep ( 2020-06-24 16:21:59 -0500 )edit

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: 2020-06-24 15:24:16 -0500

Seen: 76 times

Last updated: Jun 24