sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

Binary relations in Sage implemented #24542

Open cd38fdd3-72ba-48dd-ac57-d8359c63fec8 opened 6 years ago

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

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

Component: packages: standard

Author: Victor Porton

Branch/Commit: public/relations @ aa1564c

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

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Attachment: relations.patch.gz

Patch for Sage "develop" branch

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Changed branch from develop to none

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Changed commit from a178204 to none

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Branch: public/relations

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Changed branch from public/relations to develop

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Commit: a178204

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Changed branch from develop to public/relations

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Changed commit from a178204 to none

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Commit: bdf7549

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

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
cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Author: Victor Porton

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,3 +1 @@
 I have implemented binary relations (including composition of relations, set theoretic operations, conversion back/forth to graphs and to posets, etc.)
-
-The patch is attached.
kcrisman commented 6 years ago
comment:8

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.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from bdf7549 to 5fc5429

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

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

5fc5429added FiniteBinaryRelation.{image,reverse_image}
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

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

aa1564cadded FiniteBinaryRelation.enumerate_all()
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 6 years ago

Changed commit from 5fc5429 to aa1564c

embray commented 6 years ago
comment:11

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.

cd38fdd3-72ba-48dd-ac57-d8359c63fec8 commented 6 years ago
comment:12

@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.

slel commented 5 years ago
comment:13

There is interest for this, see

kwankyu commented 5 years ago
comment:14

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.