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

Polish the use of iterators in C graphs #6604

Closed
rlmill mannequin opened this issue Jul 23, 2009 · 14 comments
Closed

Polish the use of iterators in C graphs #6604

rlmill mannequin opened this issue Jul 23, 2009 · 14 comments

Comments

@rlmill
Copy link
Mannequin

rlmill mannequin commented Jul 23, 2009

http://groups.google.com/group/sage-devel/browse_thread/thread/2bdfa75d401575f2

CC: @kliem @tscrim

Component: graph theory

Author: David Coudert

Branch/Commit: c7dc1b1

Reviewer: Travis Scrimshaw

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

@rlmill rlmill mannequin added this to the sage-5.11 milestone Jul 23, 2009
@rlmill rlmill mannequin added c: graph theory labels Jul 23, 2009
@rlmill rlmill mannequin self-assigned this Jul 23, 2009
@rlmill

This comment has been minimized.

@rlmill
Copy link
Mannequin Author

rlmill mannequin commented Jan 9, 2010

comment:3

I am right now watching a talk on closures in Cython, which are all but finished. Then, yield statements in Cython will soon follow! So don't work on this ticket for now...

@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
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@dcoudert
Copy link
Contributor

dcoudert commented Dec 3, 2021

Branch: public/graphs/6604_iterators

@dcoudert
Copy link
Contributor

dcoudert commented Dec 3, 2021

comment:9

It seems there is little remaining to do for iterators in backends now, so let's do it.

Before

sage: a = DiGraph(graphs.CompleteGraph(100))
sage: b = a._backend
sage: %timeit L = list(b.iterator_nbrs(30))
28.3 µs ± 1.44 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

After

sage: a = DiGraph(graphs.CompleteGraph(100))
sage: b = a._backend
sage: %timeit L = list(b.iterator_nbrs(30))
18.6 µs ± 698 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

New commits:

07d52d9trac #6604: polish some iterators in backends

@dcoudert
Copy link
Contributor

dcoudert commented Dec 3, 2021

Commit: 07d52d9

@dcoudert
Copy link
Contributor

dcoudert commented Dec 3, 2021

Author: David Coudert

@dcoudert dcoudert modified the milestones: sage-6.4, sage-9.5 Dec 3, 2021
@tscrim
Copy link
Collaborator

tscrim commented Dec 4, 2021

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Dec 4, 2021

comment:10

That is quite a decent speedup and will likely have effects in other methods. Looks like some trivial failures due to slight differences in how the iteration is done:

sage -t --long --random-seed=210304412354021215508062896360889570175 src/sage/graphs/generic_graph.py
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 10654, in sage.graphs.generic_graph.GenericGraph.neighbor_iterator
Failed example:
    list(D.neighbor_iterator(0))
Expected:
    [1, 2, 3]
Got:
    [3, 1, 2]
**********************************************************************
File "src/sage/graphs/generic_graph.py", line 17591, in sage.graphs.generic_graph.GenericGraph.?
Failed example:
    list(D.depth_first_search(1, ignore_direction=True, edges=True))
Expected:
    [(1, 4), (4, 5), (5, 6), (5, 2), (4, 3)]
Got:
    [(1, 3), (3, 4), (4, 5), (5, 6), (5, 2)]

This one I am not sure if it is because of the random seed or this ticket:

sage -t --long --random-seed=210304412354021215508062896360889570175 src/sage/schemes/toric/sheaf/klyachko.py
**********************************************************************
File "src/sage/schemes/toric/sheaf/klyachko.py", line 950, in sage.schemes.toric.sheaf.klyachko.KlyachkoBundle_class.random_deformation
Failed example:
    Vtilde.cohomology(dim=True, weight=(0,))
Expected:
    (1, 0)
Got:
    (0, 0)

in either case, it should be a trivial fix.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 4, 2021

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

c7dc1b1trac #6604: fix doctests in genenric_graph.py

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 4, 2021

Changed commit from 07d52d9 to c7dc1b1

@dcoudert
Copy link
Contributor

dcoudert commented Dec 4, 2021

comment:12

I fixed the doctests in generic_graph.py.

I cannot reproduce the error in klyachko.py. It occurs in method random_deformation. Some help might be helpful here.

@dcoudert
Copy link
Contributor

dcoudert commented Dec 4, 2021

comment:13

Actually, this random error in klyachko.py has already been reported in #32773.

@tscrim
Copy link
Collaborator

tscrim commented Dec 5, 2021

comment:14

Thank you. LGTM.

@vbraun
Copy link
Member

vbraun commented Dec 12, 2021

Changed branch from public/graphs/6604_iterators to c7dc1b1

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

5 participants