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: sage-feature
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:

Status badges

Description (last modified by Victor Porton)

I have implemented binary relations (including composition of relations, set theoretic operations, conversion back/forth to graphs and to posets, etc.)

Attachments (1)

relations.patch (11.9 KB) - added by Victor Porton 5 years ago.
Patch for Sage "develop" branch

Download all attachments as: .zip

Change History (16)

Changed 5 years ago by Victor Porton

Attachment: relations.patch added

Patch for Sage "develop" branch

comment:1 Changed 5 years ago by Victor Porton

Branch: develop
Commit: a1782046e2b38388649678926edf093edad867f8

comment:2 Changed 5 years ago by Victor Porton

Branch: public/relations

comment:3 Changed 5 years ago by Victor Porton

Branch: public/relationsdevelop
Commit: a1782046e2b38388649678926edf093edad867f8

comment:4 Changed 5 years ago by Victor Porton

Branch: developpublic/relations
Commit: a1782046e2b38388649678926edf093edad867f8

comment:5 Changed 5 years ago by git

Commit: bdf75491bc8944111a8c2b6f66d589f4253b59d0

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

0ff39aeto_graph() -> to_digraph()
fc900dcmethods made properties
73e5c98transitive_closure
ef76125removed a @property
72628f5binary relations to/from (di)graphs
f5a9be2(pre)order tests
bcd24cdTODO comment
43d743aadded cartesian product and identity relation
7714732integration of posets with binary relations
bdf7549doc comments changes

comment:6 Changed 5 years ago by Victor Porton

Authors: Victor Porton
Description: modified (diff)

comment:7 Changed 5 years ago by Victor Porton

Status: newneeds_review

comment:8 Changed 5 years ago by Karl-Dieter Crisman

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 git

Commit: bdf75491bc8944111a8c2b6f66d589f4253b59d05fc5429bdbc56937b8b5839f40e4b0ee4ff93dc1

Branch pushed to git repo; I updated commit sha1. New commits:

5fc5429added FiniteBinaryRelation.{image,reverse_image}

comment:10 Changed 4 years ago by git

Commit: 5fc5429bdbc56937b8b5839f40e4b0ee4ff93dc1aa1564c771854f43d4c5dc4a0fbab97ffb448c03

Branch pushed to git repo; I updated commit sha1. New commits:

aa1564cadded FiniteBinaryRelation.enumerate_all()

comment:11 Changed 4 years ago by Erik Bray

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 top-level 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 Victor Porton

@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:13 Changed 4 years ago by Samuel Lelièvre

There is interest for this, see

comment:14 in reply to:  11 Changed 4 years ago by Kwankyu Lee

Replying to embray:

I suspect there's also probably a better place to put this than starting a new top-level package.

I agree. A top-level 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 Kwankyu Lee

Status: needs_reviewneeds_work
Note: See TracTickets for help on using tickets.