Ask Your Question

Why can't I find the spectral radius of a tree?

asked 2018-08-28 05:23:37 +0200

Gordon gravatar image

If I create some connected graphs, and ask SageMath for their spectral radius, the command never returns (well, I have only let it run for a few minutes) if the target is a tree.

Here is a simple example:

 g = graphs.CompleteBipartiteGraph(1,3)
 print g.spectrum()
 print g.spectral_radius()

The only advertised requirement for the target is that it be strongly connected, but as it is a connected graph, this should automatically be satisfied.

Yes, I can work around by computing the spectrum and taking the biggest, but I'd still like to know why this does not work.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-08-28 11:51:34 +0200

There is a bug in this method for trees. Thank you for reporting the issue. This is now ticket #26148.

edit flag offensive delete link more


@david Awesome, thanks.

Gordon gravatar imageGordon ( 2018-08-28 12:39:45 +0200 )edit

answered 2018-08-30 03:08:21 +0200

vdelecroix gravatar image

Note that this function was completely broken for any bipartite graph... not only trees. We have fixed it in the development version and should work fine with next Sage version (will be 8.4).

edit flag offensive delete link more


In fact it's already available in SageMath 8.4.beta4. One can try it on CoCalc.

slelievre gravatar imageslelievre ( 2018-09-12 13:16:21 +0200 )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

1 follower


Asked: 2018-08-28 05:23:37 +0200

Seen: 457 times

Last updated: Aug 28 '18