Skip to content

Commit

Permalink
Trac #12364: ValueError + AttributeError when calling layout_graphviz…
Browse files Browse the repository at this point in the history
… on a Hasse diagram

With sage-4.7.2 and {{{sage -i dot2tex}}} installed :

{{{
sage: m = WordMorphism('a->abb,b->ba')
sage: w = m.fixed_point('a')
sage: prefix = Word(list(w[:100]))
sage: pals = prefix.palindromes()
sage: poset = Poset((pals, lambda x,y: x.is_factor(y)))
sage: H = poset.hasse_diagram()
sage: H.layout_graphviz()         #require dot2tex
ERROR    Failed to process input
Traceback (most recent call last):
...
ValueError: invalid literal for int() with base 10: '249.88'
-------------------------------------------------------
Traceback (most recent call last):
...
AttributeError: 'str' object has no attribute 'iteritems'
}}}

This came up in #12351.

URL: https://trac.sagemath.org/12364
Reported by: slabbe
Ticket author(s): Sébastien Labbé
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager authored and vbraun committed Aug 22, 2016
2 parents aaa64dd + e80f38b commit 6b45951
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sage/graphs/generic_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -17947,6 +17947,18 @@ def layout_graphviz(self, dim = 2, prog = 'dot', **options):

Use the graphviz functionality of Networkx 1.0 once it
will be merged into Sage.

TESTS:

Make sure that :trac:`12364` is fixed::

sage: m = WordMorphism('a->abb,b->ba')
sage: w = m.fixed_point('a')
sage: prefix = Word(list(w[:100]))
sage: pals = prefix.palindromes()
sage: poset = Poset((pals, lambda x,y: x.is_factor(y)))
sage: H = poset.hasse_diagram()
sage: d = H.layout_graphviz() # optional - dot2tex graphviz
"""
assert_have_dot2tex()
assert dim == 2, "3D graphviz layout not implemented"
Expand Down

0 comments on commit 6b45951

Please sign in to comment.