Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend SubgraphSearch class #13280

Open
videlec opened this issue Jul 21, 2012 · 2 comments
Open

Extend SubgraphSearch class #13280

videlec opened this issue Jul 21, 2012 · 2 comments

Comments

@videlec
Copy link
Contributor

videlec commented Jul 21, 2012

In ask-sagemath.org (question 133) one asked the following question. Given a collection of sets how do I find a subcollection with prescribed intersections cardinality between its members. The natural way to do this is through a subgraph search but the current implementation does not allow that problem to be solved.

The patch reimplement the main method of the class SubgraphSearch adding options that allow to solve the abolve problem. An instance of the above problem is written in the documentation of sage.graphs.generic_graph.search_subgraph method.

CC: @nathanncohen

Component: graph theory

Keywords: subgraph, search, subsets

Author: Vincent Delecroix

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

@videlec videlec added this to the sage-5.11 milestone Jul 21, 2012
@videlec videlec self-assigned this Jul 21, 2012
@videlec
Copy link
Contributor Author

videlec commented Jul 21, 2012

comment:1

Attachment: trac_13280-subgraph_search.patch.gz

Hi there,

I start the review myself! I get into trouble between the two methods search_subgraph() and search_subgraph_iterator() as they do not return the same objects! In particular, as I mention in the documentation (the patch has to be changed for that), in the method search_subgraph() there is no way to get the map Vertex(H) -> Vertex(G). What can I do? An option return_map like for isomorphism test?

Vincent

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Aug 4, 2012

comment:2

Hellooo Vincent !> I start the review myself! I get into trouble between the two methods search_subgraph() and search_subgraph_iterator() as they do not return the same objects! In particular, as I mention in the documentation (the patch has to be changed for that), in the method search_subgraph() there is no way to get the map Vertex(H) -> Vertex(G). What can I do? An option return_map like for isomorphism test?

Oh, there is a way to get it back ! When you call H.vertices() you are given a list of H's vertices, and when you iterate over the subgraphs of G isomorphic to H you get a list of lists.

So if H.vertices() yields [5, 2, 3, 4, 6] and one of the elements of the list of lists is [50, 30, 15, 66, 88], then it means that the map you are looking for is :
5 > 50
2 > 30
15 > 3
66 > 4
88 > 6

I cannot give you an example right now as I do not have Sage installed on my computer (and sagenb.org is sloooooooooooooooooooooooooooooow), but that's how it should work :-)

Nathann

P.S. : Oh, and even though I agree that the DenseGraph should be rewritten, an integer on a 64-bits machine still uses 64 times more space than a bit, and is slower. Ideally some class should be created that does with dense graphs what "static sparce graphs" [1] does for sparse graphs, so that there is no time lost on labels when using that class.

[1] http://www.sagemath.org/doc/reference/sage/graphs/base/static_sparse_graph.html

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants