Opened 6 years ago
Closed 6 years ago
#22950 closed defect (fixed)
combinat/posets/posets.py fails when the optional package dot2tex is installed
Reported by:  strogdon  Owned by:  

Priority:  major  Milestone:  sage8.0 
Component:  graphics  Keywords:  
Cc:  chapoton, jmantysalo, kdilks, tscrim  Merged in:  
Authors:  Travis Scrimshaw  Reviewers:  Jori Mäntysalo 
Report Upstream:  N/A  Work issues:  
Branch:  12dc47d (Commits, GitHub, GitLab)  Commit:  12dc47d5c9f58264e9c3f02dcc108bf7758e0dd8 
Dependencies:  Stopgaps: 
Description (last modified by )
As reported at https://groups.google.com/d/msg/sagerelease/UdllnAJFufA/e8ArqwFBAAJ there is often a failure when
testing combinat/posets/posets.py
sage t long src/sage/combinat/posets/posets.py ********************************************************************** File "src/sage/combinat/posets/posets.py", line 1742, in sage.combinat.posets.posets.FinitePoset.? Failed example: L.plot(figsize=12, border=True, element_shape='s', element_size=400, element_color='white', element_colors={'blue': F, 'green': L.double_irreducibles()}, cover_color='lightgray', cover_colors={'black': F_internal}, title='The Frattini\nsublattice in blue', fontsize=10) Exception raised: Traceback (most recent call last): File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 509, in _run self.compile_and_execute(example, compiler, test.globs) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/doctest/forker.py", line 872, in compile_and_execute exec(compiled, globs) File "<doctest sage.combinat.posets.posets.FinitePoset.?[12]>", line 5, in <module> title='The Frattini\nsublattice in blue', fontsize=Integer(10)) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/combinat/posets/posets.py", line 1834, in plot **kwds) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/misc/decorators.py", line 564, in wrapper return func(*args, **options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/generic_graph.py", line 18733, in plot return self.graphplot(**options).plot() File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/generic_graph.py", line 18384, in graphplot return GraphPlot(graph=self, options=options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/graph_plot.py", line 262, in __init__ self.set_pos() File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/graph_plot.py", line 346, in set_pos self._pos = self._graph.layout(**self._options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/generic_graph.py", line 17847, in layout pos = getattr(self, "layout_%s"%layout)(dim = dim, **options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/digraph.py", line 2915, in layout_acyclic return self.layout_graphviz(rankdir=rankdir, **options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/generic_graph.py", line 18315, in layout_graphviz positions = dot2tex.dot2tex(self.graphviz_string(**options), format = "positions", prog = prog) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/misc/decorators.py", line 564, in wrapper return func(*args, **options) File "/usr/local/sage8/local/lib/python2.7/sitepackages/sage/graphs/generic_graph.py", line 19532, in graphviz_string "%s is not a valid format for edge"%(edge) AssertionError: [0, 4] is not a valid format for edge
The failure occurs because graphviz_string
does not allow edges to be given as lists (exposed by #18545).
Change History (11)
comment:1 followup: 2 Changed 6 years ago by
comment:2 Changed 6 years ago by
comment:3 Changed 6 years ago by
Description:  modified (diff) 

comment:4 Changed 6 years ago by
That portion of the L.plot(...)
call is cover_colors={'black': F_internal}
. If it is removed then the posets.py
test passes even with dot2tex
installed.
comment:5 Changed 6 years ago by
Description:  modified (diff) 

Okay, it might not be as simple as exposing a bug but bad input. If I use
F_internal = [(c[0],c[1],None) for c in F.cover_relations() if c in L.cover_relations()]
then I can see the plot.
comment:6 Changed 6 years ago by
<selfhatred>It's amazing how useful error messages are...</selfhatred>
comment:7 Changed 6 years ago by
Actually, this even works:
sage: F_internal = [tuple(c) for c in F.cover_relations() if c in L.cover_relations()]
Which makes sense considering the assertion is checking assert isinstance(edge, tuple)
. What I suggest is making it also allow list
.
comment:8 Changed 6 years ago by
Authors:  → Travis Scrimshaw 

Branch:  → public/graphviz_edges_lists22950 
Commit:  → 12dc47d5c9f58264e9c3f02dcc108bf7758e0dd8 
Description:  modified (diff) 
Status:  new → needs_review 
Here's a branch with a MWE as a doctest.
New commits:
12dc47d  Allow graphviz_string to take edges that are lists.

comment:11 Changed 6 years ago by
Branch:  public/graphviz_edges_lists22950 → 12dc47d5c9f58264e9c3f02dcc108bf7758e0dd8 

Resolution:  → fixed 
Status:  positive_review → closed 
This was not caused by #18545 but instead simply exposed.