ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 12 Sep 2018 06:16:21 -0500Why can't I find the spectral radius of a tree?http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/ 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.Mon, 27 Aug 2018 22:23:37 -0500http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/Answer by David Coudert for <p>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. </p>
<p>Here is a simple example:</p>
<pre><code> g = graphs.CompleteBipartiteGraph(1,3)
print g.spectrum()
print g.spectral_radius()
</code></pre>
<p>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.</p>
<p>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.</p>
http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?answer=43499#post-id-43499There is a bug in this method for trees. Thank you for reporting the issue. This is now ticket [#26148](https://trac.sagemath.org/ticket/26148).Tue, 28 Aug 2018 04:51:34 -0500http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?answer=43499#post-id-43499Comment by Gordon for <p>There is a bug in this method for trees. Thank you for reporting the issue. This is now ticket <a href="https://trac.sagemath.org/ticket/26148">#26148</a>.</p>
http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?comment=43500#post-id-43500@David Awesome, thanks.Tue, 28 Aug 2018 05:39:45 -0500http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?comment=43500#post-id-43500Answer by vdelecroix for <p>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. </p>
<p>Here is a simple example:</p>
<pre><code> g = graphs.CompleteBipartiteGraph(1,3)
print g.spectrum()
print g.spectral_radius()
</code></pre>
<p>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.</p>
<p>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.</p>
http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?answer=43524#post-id-43524Note 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).Wed, 29 Aug 2018 20:08:21 -0500http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?answer=43524#post-id-43524Comment by slelievre for <p>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).</p>
http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?comment=43650#post-id-43650In fact it's already available in SageMath 8.4.beta4. One can [try it on CoCalc](https://cocalc.com/share/fc94de41-6af4-4ee1-a684-c33a9e56b2b0/spectral-radius-of-graph.ipynb?viewer=share).Wed, 12 Sep 2018 06:16:21 -0500http://ask.sagemath.org/question/43496/why-cant-i-find-the-spectral-radius-of-a-tree/?comment=43650#post-id-43650