Opened 5 years ago
Last modified 4 years ago
#24542 needs_work enhancement
Binary relations in Sage implemented
Reported by:  Victor Porton  Owned by:  

Priority:  major  Milestone:  sagefeature 
Component:  packages: standard  Keywords:  
Cc:  Merged in:  
Authors:  Victor Porton  Reviewers:  
Report Upstream:  N/A  Work issues:  
Branch:  public/relations (Commits, GitHub, GitLab)  Commit:  aa1564c771854f43d4c5dc4a0fbab97ffb448c03 
Dependencies:  Stopgaps: 
Description (last modified by )
I have implemented binary relations (including composition of relations, set theoretic operations, conversion back/forth to graphs and to posets, etc.)
Attachments (1)
Change History (16)
Changed 5 years ago by
Attachment:  relations.patch added 

comment:1 Changed 5 years ago by
Branch:  develop 

Commit:  a1782046e2b38388649678926edf093edad867f8 
comment:2 Changed 5 years ago by
Branch:  → public/relations 

comment:3 Changed 5 years ago by
Branch:  public/relations → develop 

Commit:  → a1782046e2b38388649678926edf093edad867f8 
comment:4 Changed 5 years ago by
Branch:  develop → public/relations 

Commit:  a1782046e2b38388649678926edf093edad867f8 
comment:5 Changed 5 years ago by
Commit:  → bdf75491bc8944111a8c2b6f66d589f4253b59d0 

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
0ff39ae  to_graph() > to_digraph()

fc900dc  methods made properties

73e5c98  transitive_closure

ef76125  removed a @property

72628f5  binary relations to/from (di)graphs

f5a9be2  (pre)order tests

bcd24cd  TODO comment

43d743a  added cartesian product and identity relation

7714732  integration of posets with binary relations

bdf7549  doc comments changes

comment:6 Changed 5 years ago by
Authors:  → Victor Porton 

Description:  modified (diff) 
comment:7 Changed 5 years ago by
Status:  new → needs_review 

comment:8 Changed 5 years ago by
This could be quite useful. It looks like you need quite a bit of documentation/examples for the many methods involved. Especially the back/forth with posets, if robust, would be great  see e.g. this stack overflow question.
comment:9 Changed 4 years ago by
Commit:  bdf75491bc8944111a8c2b6f66d589f4253b59d0 → 5fc5429bdbc56937b8b5839f40e4b0ee4ff93dc1 

Branch pushed to git repo; I updated commit sha1. New commits:
5fc5429  added FiniteBinaryRelation.{image,reverse_image }

comment:10 Changed 4 years ago by
Commit:  5fc5429bdbc56937b8b5839f40e4b0ee4ff93dc1 → aa1564c771854f43d4c5dc4a0fbab97ffb448c03 

Branch pushed to git repo; I updated commit sha1. New commits:
aa1564c  added FiniteBinaryRelation.enumerate_all()

comment:11 followup: 14 Changed 4 years ago by
I'm surprised something like this isn't already in Sage though that's not something I'm really qualified to comment on. I suspect there's also probably a better place to put this than starting a new toplevel package.
I can make some minor nitpicks on the code itself if you think that would be helpful.
comment:12 Changed 4 years ago by
@embray I don't know if your nitpicks are good. After all, I know nothing about you. You decide if you do the work.
I am going to add yet one feature: Converting a function into a binary relation. However I will be busy today. I have not yet dived into details of this feature.
comment:14 Changed 4 years ago by
Replying to embray:
I suspect there's also probably a better place to put this than starting a new toplevel package.
I agree. A toplevel package is supposed to contain many modules and/or packages.
I suggest to put this module into sage.combinat.relations
.
On the other hand, sage.sets.relations
would be a bad choice as sage.sets
is concerned with generic sets.
comment:15 Changed 4 years ago by
Status:  needs_review → needs_work 

Patch for Sage "develop" branch