Opened 10 years ago
Closed 8 years ago
#10360 closed defect (duplicate)
Polyhedron.vertex_adjacencies() gives different answers because of a side effect
Reported by: | jplabbe | Owned by: | mhampton |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | geometry | Keywords: | vertex adjacencies, polyhedron |
Cc: | vbraun | Merged in: | |
Authors: | Reviewers: | Volker Braun, Andrey Novoseltsev | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The vertex_adjacencies function returns a list giving the adjacency of every vertex of a polyhedron.
If you assign this list and modify it, it will also modify the output of any new call of vertex_adjacencies, which shouldn't be the case.
This can be reproduced in the following manner:
sage: P=Polyhedron([[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]);P.vertex_adjacencies() [[0, [1, 2]], [1, [0, 3]], [2, [0, 4]], [3, [1, 5]], [4, [2, 5]], [5, [3, 4]]] sage: V_adj=P.vertex_adjacencies();V_adj [[0, [1, 2]], [1, [0, 3]], [2, [0, 4]], [3, [1, 5]], [4, [2, 5]], [5, [3, 4]]] sage: V_adj[0][1].remove(1);V_adj [[0, [2]], [1, [0, 3]], [2, [0, 4]], [3, [1, 5]], [4, [2, 5]], [5, [3, 4]]] sage: P.vertex_adjacencies() [[0, [2]], [1, [0, 3]], [2, [0, 4]], [3, [1, 5]], [4, [2, 5]], [5, [3, 4]]]
Change History (5)
comment:1 Changed 10 years ago by
- Cc vbraun added
comment:2 Changed 10 years ago by
We should deprecate the method and eventually remove it. Its just a bad API in so many ways... and changing lists of lists on nondescript integers into tuples of tuples of nondescript integers does not fix it :-)
comment:3 Changed 8 years ago by
- Milestone changed from sage-5.9 to sage-duplicate/invalid/wontfix
- Status changed from new to needs_review
This was fixed (i.e. deprecated) in #11763. Close as duplicate.
comment:4 Changed 8 years ago by
- Reviewers set to Andrey Novoseltsev
- Status changed from needs_review to positive_review
comment:5 Changed 8 years ago by
- Resolution set to duplicate
- Reviewers changed from Andrey Novoseltsev to Volker Braun, Andrey Novoseltsev
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
I would suggest switching to tuples instead of lists for cached values.