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

improve method _build_flow_graph #26941

Closed
dcoudert opened this issue Dec 22, 2018 · 7 comments
Closed

improve method _build_flow_graph #26941

dcoudert opened this issue Dec 22, 2018 · 7 comments

Comments

@dcoudert
Copy link
Contributor

We use method is_directed_acyclic to find cycles instead of computing shortest paths. This should have been done long ago as it's faster this way.

Before:

sage: D = digraphs.TransitiveTournament(10)
sage: D.add_edges((i+1, i) for i in range(9))
sage: flow = {e: 1 for e in D.edge_iterator(labels=0)}
sage: %time F = D._build_flow_graph(flow, False)
CPU times: user 1.45 ms, sys: 320 µs, total: 1.77 ms
Wall time: 1.55 ms

After:

sage: D = digraphs.TransitiveTournament(10)
sage: D.add_edges((i+1, i) for i in range(9))
sage: flow = {e: 1 for e in D.edge_iterator(labels=0)}
sage: %time F = D._build_flow_graph(flow, False)
CPU times: user 958 µs, sys: 244 µs, total: 1.2 ms
Wall time: 1.02 ms

Component: graph theory

Author: David Coudert

Branch/Commit: 0a24c03

Reviewer: Travis Scrimshaw

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

@dcoudert dcoudert added this to the sage-8.6 milestone Dec 22, 2018
@dcoudert
Copy link
Contributor Author

New commits:

0a24c03trac #26941: improve _build_flow_graph

@dcoudert
Copy link
Contributor Author

Branch: public/26941_build_flow_graph

@dcoudert

This comment has been minimized.

@dcoudert
Copy link
Contributor Author

Commit: 0a24c03

@tscrim
Copy link
Collaborator

tscrim commented Dec 23, 2018

comment:2

This seems like a better approach (at least it makes the code more natural). So LGTM.

@tscrim
Copy link
Collaborator

tscrim commented Dec 23, 2018

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Dec 27, 2018

Changed branch from public/26941_build_flow_graph to 0a24c03

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

3 participants