Ticket #8353 (closed enhancement: fixed)
Adding height() and width() functions to square grid paths
|Reported by:||abmasse||Owned by:||abmasse|
|Component:||combinatorics||Keywords:||paths, height, width|
|Cc:||slabbe, sage-combinat||Work issues:|
|Report Upstream:||N/A||Reviewers:||Sébastien Labbé|
|Authors:||Alexandre Blondin Massé||Merged in:||sage-4.3.4.alpha1|
Description (last modified by abmasse) (diff)
When dealing with 2d word paths, it is very useful to know their height and their width.
In particular, one can compute a bounding box for a better displaying. The aim of this small ticket is to add those two functionalities.
By the way, while testing it, I noticed a strange behavior:
sage: Paths = WordPaths('abcABC') sage: p = Paths('acABC') sage: points = list(p.points()) sage: points [(0, 0), (1, 0), (1/2, 1/2*sqrt3), (-1/2, 1/2*sqrt3), (-1, 0), (-1/2, -1/2*sqrt3)] sage: y_coords = map(lambda (_,y):y, points) sage: y_coords [0, 0, 1/2*sqrt3, 1/2*sqrt3, 0, -1/2*sqrt3] sage: max(y_coords) -1/2*sqrt3
Shouldn't 1/2*sqrt3 be the highest element ? This doesn't make sense.
Changed 3 years ago by abmasse
- attachment trac_8353_square_grid_word_paths_height_width-abm.patch added
- Reviewers set to Sébastien Labbé
- Authors set to Alexandre Blondin Massé