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

Better use of graphs in src/sage/geometry/hyperplane_arrangement/library.py #34306

Closed
dcoudert opened this issue Aug 8, 2022 · 7 comments
Closed

Comments

@dcoudert
Copy link
Contributor

dcoudert commented Aug 8, 2022

Typical changes are

-        for e in G.edges(sort=True):
-            i = G.vertices(sort=True).index(e[0])
-            j = G.vertices(sort=True).index(e[1])
+        vertex_to_int = {u: i for i, u in enumerate(G)}
+        for u, v in G.edge_iterator(labels=False, sort_vertices=False):
+            i = vertex_to_int[u]
+            j = vertex_to_int[v]

On the way, we also improve some calls to .index(...) in src/sage/geometry/.

Component: geometry

Author: David Coudert

Branch/Commit: b19f265

Reviewer: Frédéric Chapoton

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

@dcoudert dcoudert added this to the sage-9.7 milestone Aug 8, 2022
@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 8, 2022

New commits:

fe6f742trac #34306: better use of graphs in src/sage/geometry/hyperplane_arrangement/library.py
bde3fe0trac #34306: small improvement in src/sage/geometry/fan.py
e351e42trac #34306: small improvement in src/sage/geometry/latice_polytope.py
b19f265trac #34306: small improvements in src/sage/geometry/polyhedron/

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 8, 2022

Branch: public/geometry/34306

@dcoudert
Copy link
Contributor Author

dcoudert commented Aug 8, 2022

Commit: b19f265

@dcoudert

This comment has been minimized.

@dcoudert dcoudert changed the title Better use of graphs in src/sage/geometry/ Better use of graphs in src/sage/geometry/hyperplane_arrangement/library.py Aug 8, 2022
@fchapoton
Copy link
Contributor

comment:2

super, merci

@fchapoton
Copy link
Contributor

Reviewer: Frédéric Chapoton

@vbraun
Copy link
Member

vbraun commented Aug 30, 2022

Changed branch from public/geometry/34306 to b19f265

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