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

asked 2018-08-27 22:23:37 -0500

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

Comments

2

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

David Coudert gravatar imageDavid Coudert ( 2018-08-28 04:51:34 -0500 )edit

@david Awesome, thanks.

Gordon gravatar imageGordon ( 2018-08-28 05:39:45 -0500 )edit
1

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).

vdelecroix gravatar imagevdelecroix ( 2018-08-29 20:08:21 -0500 )edit

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

slelievre gravatar imageslelievre ( 2018-09-12 06:16:21 -0500 )edit