ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 27 Nov 2018 05:33:41 -0600Where has _circle_embedding gone?https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/After nearly killing myself (in frustration) installing Sage 8.4 from source on OSX 10.14.1 (Mojave), I discover that a graph plotting command that I frequently use has vanished, breaking a number of my own programs.
Previously (on SageMath up to 8.2) I would do
from sage.graphs.graph_plot import _circle_embedding
in order to access this.
Now I just get
ImportError: cannot import name _circle_embedding
I can relatively easily replace this *particular* function myself, but if it were something more complicated, I would be at a loss to know how to track down the cause for its disappearance and figure out how to get it back.
So I guess the questions are: has it only vanished for me due to a botched or incomplete installation, or has it somehow been removed from Sage? In either case, how can I recover it?Tue, 27 Nov 2018 02:59:33 -0600https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/Answer by slelievre for <p>After nearly killing myself (in frustration) installing Sage 8.4 from source on OSX 10.14.1 (Mojave), I discover that a graph plotting command that I frequently use has vanished, breaking a number of my own programs.</p>
<p>Previously (on SageMath up to 8.2) I would do</p>
<pre><code>from sage.graphs.graph_plot import _circle_embedding
</code></pre>
<p>in order to access this.</p>
<p>Now I just get </p>
<pre><code>ImportError: cannot import name _circle_embedding
</code></pre>
<p>I can relatively easily replace this <em>particular</em> function myself, but if it were something more complicated, I would be at a loss to know how to track down the cause for its disappearance and figure out how to get it back.</p>
<p>So I guess the questions are: has it only vanished for me due to a botched or incomplete installation, or has it somehow been removed from Sage? In either case, how can I recover it?</p>
https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/?answer=44468#post-id-44468In such a case you can inspect the source code repository, which is under version control.
One way to do that is at GitHub, where a copy of the version controlled repository exists.
Since the import was
from sage.graphs.graph_plot import _circle_embedding
one can visit
- [https://github.com/sagemath/sage/blob/master/src/sage/graphs/](https://github.com/sagemath/sage/blob/master/src/sage/graphs/)
and see the file
- [https://github.com/sagemath/sage/blob/master/src/sage/graphs/graph_plot.py](https://github.com/sagemath/sage/blob/master/src/sage/graphs/graph_plot.py)
The "History" button reveals commits that changed this file.
The last of those is "trac #22050: move methods to generic_graph.py and update usage"
and by clicking it you can see how the usage of `_circle_embedding` has evolved.
In particular, `_circle_embedding` is now a method you can apply to any graph directly
without a need to import it.
For example, instead of doing:
sage: g = Graph('HKN?Yeb')
sage: from sage.graphs.graph_plot import _circle_embedding
sage: _circle_embedding(g, [1, 2, 4, 3, 0, 5])
the usage is now more direct, without import:
sage: g = Graph('HKN?Yeb')
sage: g._circle_embedding([1, 2, 4, 3, 0, 5])
Note that functions or methods starting with a single underscore `_` are
"private methods" and there is not much guarantee on them, including
that they will still exist, or stay the same, or stay in the same place.
Tue, 27 Nov 2018 04:55:00 -0600https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/?answer=44468#post-id-44468Comment by Gordon for <p>In such a case you can inspect the source code repository, which is under version control.</p>
<p>One way to do that is at GitHub, where a copy of the version controlled repository exists.</p>
<p>Since the import was</p>
<pre><code>from sage.graphs.graph_plot import _circle_embedding
</code></pre>
<p>one can visit</p>
<ul>
<li><a href="https://github.com/sagemath/sage/blob/master/src/sage/graphs/">https://github.com/sagemath/sage/blob/master/src/sage/graphs/</a></li>
</ul>
<p>and see the file</p>
<ul>
<li><a href="https://github.com/sagemath/sage/blob/master/src/sage/graphs/graph_plot.py">https://github.com/sagemath/sage/blob/master/src/sage/graphs/graph_plot.py</a></li>
</ul>
<p>The "History" button reveals commits that changed this file.</p>
<p>The last of those is "trac #22050: move methods to generic_graph.py and update usage"
and by clicking it you can see how the usage of <code>_circle_embedding</code> has evolved.</p>
<p>In particular, <code>_circle_embedding</code> is now a method you can apply to any graph directly
without a need to import it.</p>
<p>For example, instead of doing:</p>
<pre><code>sage: g = Graph('HKN?Yeb')
sage: from sage.graphs.graph_plot import _circle_embedding
sage: _circle_embedding(g, [1, 2, 4, 3, 0, 5])
</code></pre>
<p>the usage is now more direct, without import:</p>
<pre><code>sage: g = Graph('HKN?Yeb')
sage: g._circle_embedding([1, 2, 4, 3, 0, 5])
</code></pre>
<p>Note that functions or methods starting with a single underscore <code>_</code> are
"private methods" and there is not much guarantee on them, including
that they will still exist, or stay the same, or stay in the same place.</p>
https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/?comment=44469#post-id-44469A perfect answer I think, covering exactly what I needed to know. Awesome.Tue, 27 Nov 2018 05:33:41 -0600https://ask.sagemath.org/question/44467/where-has-_circle_embedding-gone/?comment=44469#post-id-44469