Opened 5 years ago
Closed 5 years ago
#16257 closed defect (fixed)
Unnatural syntax of G.relabel()
Reported by:  ncohen  Owned by:  

Priority:  major  Milestone:  sage6.3 
Component:  graph theory  Keywords:  
Cc:  Merged in:  
Authors:  Nathann Cohen  Reviewers:  Pedro Cruz 
Report Upstream:  N/A  Work issues:  
Branch:  b164033 (Commits)  Commit:  b16403318006a27e6861558693ad8a76cc4ce4df 
Dependencies:  Stopgaps: 
Description
This was reported on sagesupport by Pedro Cruz:
sage: G = graphs.PetersenGraph() sage: G.relabel( [ i+1 for i in range(G.order()) ], inplace=True ) sage: G.relabel( [ i+1 for i in range(G.order()) ], inplace=True )
This is because relabeling with a list as an argument only works when the graph's vertices are 0,...,n1
. With this branch this syntax always works, by using for the graph's vertices the order given by G.vertices()
. Should not lead to any confusion I hope.
Nathann
Change History (9)
comment:1 Changed 5 years ago by
 Branch set to u/ncohen/16257
 Status changed from new to needs_review
comment:2 Changed 5 years ago by
 Commit set to b05052ef8ee185fe625ff0a61a45c4b0a82eaeb4
comment:3 Changed 5 years ago by
 Commit changed from b05052ef8ee185fe625ff0a61a45c4b0a82eaeb4 to b16403318006a27e6861558693ad8a76cc4ce4df
Branch pushed to git repo; I updated commit sha1. New commits:
b164033  trac #16257: Broken doctests

comment:4 Changed 5 years ago by
 Status changed from needs_review to positive_review
I've done the following instructions and checked that the reported situation has been solved.
sage: G = graphs.PetersenGraph() sage: G.relabel( [1,2,3,4,5,6,7,8,9,10], inplace=True ) sage: G.relabel( [1,2,3,4,5,6,7,8,9,10], inplace=True ) sage: G.vertices() [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sage: G.relabel( lambda i: i+1, inplace=True ) sage: G.vertices() [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] sage: G.relabel( [1,2,3,4,5,6,7,8,9,10], inplace=True ) sage: G.vertices() [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Also, sage t graphs/ got "All tests passed!".
comment:5 Changed 5 years ago by
 Milestone changed from sage6.2 to sage6.3
comment:6 Changed 5 years ago by
Reviewer name
comment:7 Changed 5 years ago by
Reviewer name
comment:8 Changed 5 years ago by
 Reviewers set to Pedro Cruz
comment:9 Changed 5 years ago by
 Branch changed from u/ncohen/16257 to b16403318006a27e6861558693ad8a76cc4ce4df
 Resolution set to fixed
 Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
Branch pushed to git repo; I updated commit sha1. New commits:
trac #16257: Unnatural syntax of G.relabel()