Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rooted trees #11529

Closed
hivert opened this issue Jun 21, 2011 · 130 comments
Closed

Rooted trees #11529

hivert opened this issue Jun 21, 2011 · 130 comments

Comments

@hivert
Copy link

hivert commented Jun 21, 2011

Implement combinatorial (unordered) rooted trees

This is done using ordered rooted trees as data structure, and recursive normalization.

CC: @sagetrac-sage-combinat @tscrim @darijgr

Component: combinatorics

Keywords: rooted trees

Author: Florent Hivert

Branch/Commit: dc8120f

Reviewer: Frédéric Chapoton, Darij Grinberg, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/11529

@hivert hivert added this to the sage-5.11 milestone Jun 21, 2011
@hivert hivert self-assigned this Jun 21, 2011
@hivert
Copy link
Author

hivert commented Nov 21, 2011

Changed dependencies from #11407 to #11407, #10194

@hivert

This comment has been minimized.

@dkrenn
Copy link
Contributor

dkrenn commented Feb 26, 2012

comment:2

Attachment: trac_11529-rooted_trees-fh.patch.gz

Patch cannot be applied. If this is just because of the unfinished #10194 (I don't know the current status of that), then it can be set back to "need review".

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@fchapoton
Copy link
Contributor

comment:5

Florent, is this the latest patch from the sage-combinat queue ? If not, it would be good to refresh, so that one can start working on it here.

@fchapoton
Copy link
Contributor

Branch: u/chapoton/11529

@fchapoton
Copy link
Contributor

comment:6

I have made a branch from the latest sage-combinat patch, plus some details corrected.


New commits:

3375d21#11529: data structure and enumerated sets for rooted trees.
bad8590trac #11529 pyflakes details

@fchapoton
Copy link
Contributor

Commit: bad8590

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

f0bd132trac #11529 minor details

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Changed commit from bad8590 to f0bd132

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Changed commit from f0bd132 to 5a15e07

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

5a15e07trac #11529 trying to make it work

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

5849b28trac #11529 tests seem to pass

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 21, 2014

Changed commit from 5a15e07 to 5849b28

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2014

Changed commit from 5849b28 to 0047c1a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 2, 2014

Branch pushed to git repo; I updated commit sha1. New commits:

0047c1aMerge branch 'u/chapoton/11529' of ssh://trac.sagemath.org:22/sage into 11529

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 8, 2014

Changed commit from 0047c1a to ca70054

@vbraun
Copy link
Member

vbraun commented Apr 22, 2015

comment:82

On 32-bit:

sage -t --long src/sage/combinat/rooted_tree.py
**********************************************************************
File "src/sage/combinat/rooted_tree.py", line 259, in sage.combinat.rooted_tree.RootedTree.__hash__
Failed example:
    hash(RT([[],[[]]]))  # indirect doctest
Expected:
    2578595415271398032
Got:
    1119083152
**********************************************************************
File "src/sage/combinat/rooted_tree.py", line 891, in sage.combinat.rooted_tree.LabelledRootedTree.__hash__
Failed example:
    hash(lb)  # indirect doctest
Expected:
    686798862222558969
Got:
    652936953
**********************************************************************
2 items had failures:
   1 of   3 in sage.combinat.rooted_tree.LabelledRootedTree.__hash__
   1 of   3 in sage.combinat.rooted_tree.RootedTree.__hash__
    [155 tests, 2 failures, 1.79 s]

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 22, 2015

Changed commit from dc0ebfe to 811a797

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 22, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

811a797fix two hash docstrings

@darijgr
Copy link
Contributor

darijgr commented Apr 22, 2015

comment:84

Good call -- I don't know how I missed them.

@fchapoton
Copy link
Contributor

comment:85

No, no ! This hash should be different for 32 and 64 bits !

@darijgr
Copy link
Contributor

darijgr commented Apr 22, 2015

comment:86

You mean "should be" or "is"? What is going on here? Why should a hash (computed via sort_key) be machine-dependent?

@fchapoton
Copy link
Contributor

comment:87

The hash is different.
See many places, for example:

            sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
            sage: B = F.basis()
            sage: f = B['a'] + 3*B['c']
            sage: hash(f)
            6429418278783588506           # 64-bit
            726440090                     # 32-bit

@darijgr
Copy link
Contributor

darijgr commented Apr 22, 2015

comment:88

Oh! Should it be marked #random?

@fchapoton
Copy link
Contributor

comment:89

No, it should have the two possible answers as in the example above.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 22, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

e8ed592Merge branch 'public/combinat/11529' of git://trac.sagemath.org/sage into tree
dc8120fnew attempt at fixing doctests, can only check 32bit

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Apr 22, 2015

Changed commit from 811a797 to dc8120f

@fchapoton
Copy link
Contributor

comment:91

good for me on 64-bit

@darijgr
Copy link
Contributor

darijgr commented Apr 22, 2015

comment:92

Thank you!

@tscrim
Copy link
Collaborator

tscrim commented Apr 22, 2015

comment:93

The easier test to make sure the hash is working is to do something like hash(x) == hash(x) (unless of course you're expecting a specific value, like hash(1) == 1), and it doesn't cause trivial doctest failures for changes to the hash function, but it probably doesn't really matter here.

@hivert
Copy link
Author

hivert commented Apr 22, 2015

comment:94

Replying to @tscrim:

The easier test to make sure the hash is working is to do something like hash(x) == hash(x) (unless of course you're expecting a specific value, like hash(1) == 1), and it doesn't cause trivial doctest failures for changes to the hash function, but it probably doesn't really matter here.

If you use the same x then you are not testing anything serious. A good test would be hash(x) == hash(y) with x and y two distinct but equal objects.

Florent which is coming back to Sage after a long absence.

By the way : Tanks to all of you for finishing this one !

@fchapoton
Copy link
Contributor

comment:95

Hello Florent. Glad to see you back.

To finish this ticket, I had to get rid of the dependency to #10194.
If I could suggest something, that would be to take care of #10194. It would certainly
help several people, that have based many of their tickets on that one.

@vbraun
Copy link
Member

vbraun commented Apr 23, 2015

Changed branch from public/combinat/11529 to dc8120f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants