sagemath / sage

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

Add is_partial_cube #19985

Closed jaanos closed 8 years ago

jaanos commented 8 years ago

This ticket adds a method is_partial_cube to the Graph class, which checks whether a graph is a partial cube. A partial cube is a graph that can be isometrically embedded into a hypercube, i.e., its vertices can be labelled with (0,1)-vectors of some fixed length such that the distance between any two vertices in the graph equals the Hamming distance of their labels. If requested, this labelling can also be returned by the method.

The code for this method comes from the PADS library by David Eppstein, which is available at http://www.ics.uci.edu/~eppstein/PADS/. The library is available under the MIT license, and I have also obtained permission from the author via email. The algorithm in question has been described in a paper available at http://arxiv.org/pdf/0705.1025.pdf.

The code has been changed to utilize Sage's structures (namely graphs, digraphs and disjoint sets). However, specialized breadth-first and depth-first search methods for graphs from the PADS library have also been added.

CC: @nathanncohen

Component: graph theory

Keywords: graphs partial cubes

Author: Janoš Vidali

Branch: 5a054a6

Reviewer: Nathann Cohen

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

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 8 years ago
comment:37

Sorry for the slow review, I'm still trying to make sense of the last block of the algorithm, the one which relies on a DFS.

Is there any reason to keep neighbors and ignore_direction in your DFS/BFS routines? You do not use them.

Nathann

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 8 years ago
comment:38

OH. Just got it.

Chocolate works wonders.

And I do eat a lot of it.

Nathann

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

Changed commit from 372d658 to 1ef4e6a

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

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

1ef4e6atrac #19985: More doc
6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 8 years ago
comment:40

Hello Janoš !

I finally understood the last block of code, and updated the doc. I'm setting this to needs_info pending your answer about the useless parameters of bfs/dfs.

Nathann

jaanos commented 8 years ago
comment:41

Hi!

Is there any reason to keep neighbors and ignore_direction in your DFS/BFS routines? You do not use them.

No, you can remove them. They are a remnant of the first commit, when these functions were still in generic_graph.py.

Janoš

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

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

6eac601trac #19985: Remove keywords
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 1ef4e6a to 6eac601

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 8 years ago

Reviewer: Nathann Cohen

6bdad4c1-1e26-4f2f-a442-a01a2292c181 commented 8 years ago
comment:43

Yo !

If you agree with the branch in its current status, you can set the ticket to positive_review. Thanks for this code !

Nathan

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

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

5a054a6Some more fixes to the doc
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 8 years ago

Changed commit from 6eac601 to 5a054a6

jaanos commented 8 years ago
comment:45

Hi!

I've made some small fixes - nothing critical, so I guess it's OK if I set the ticket to positive_review. Thanks again for reviewing and writing the documentation!

Janoš

vbraun commented 8 years ago

Changed branch from public/19985 to 5a054a6

jaanos commented 8 years ago

Changed commit from 5a054a6 to none

jaanos commented 8 years ago
comment:47

Thank you all guys!