-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
cartesian product of directed graphs #12770
Comments
Author: David Coudert |
comment:2
This patch should solve the problem. |
comment:3
Small modification to allow loops in directed graphs. |
comment:4
Replying to @dcoudert:
|
comment:5
It was original examples. I removed them. They are not so useful.
Already done with is_isomorphic tests.
I added a test with loops: small De Bruijn product an arc. The resulting digraph contains 2 copies of the debruijn and arcs from vertices in one copy to corresponding vertex in other copy. Should be better now. |
comment:6
raise TypeError('Both arguments must be of the same class.') to be more precise : 'The graphs should be both directed or both undirected.'
|
comment:7
Replying to @fchapoton:
Since the tests are displayed both in the documentation and in the
Done in new version.
Done in patch #12791. |
comment:8
Replying to @dcoudert:
Please upload the new version, and I will give a positive review. |
comment:9
here it is, sorry. |
comment:10
According to Nicolas Thiery : Once the graph G is created, the whole end of this method would be
I do not know if this is better, in any way, than what you wrote. Maybe faster ? If you do not want to spend more time on this ticket, I can give a positive review for the current patch. |
comment:11
Unfortunately your proposal is slower than the implementation of this patch. With this patch:
With your proposal on the same graphs:
So I propose to stay with current implementation. |
comment:12
ok, I give a positive review. Thanks for your work. |
Reviewer: Frédéric Chapoton |
comment:13
You are welcome ! |
comment:14
Replying to @dcoudert:
Interesting that calling repeatedly add_edge is faster than add_edges! I am fine with the current implementation, though maybe using edge_iterator would be faster, since the former does a sort (which I don't like but that's another story). I let you see if you want to do that. |
Attachment: trac_12770_cartesian_product.patch.gz |
comment:15
Replying to @nthiery:
The point is that using add_edges, we first create a new list of edges, and then iterate this list to add edges to the new graph. So somehow we do the job twice. My tests suggest that current implementation is a bit faster.
I have changed the patch to use the edge_iterator. It is now slightly faster (few ms less on large graphs). |
comment:17
This change still needs review. |
Changed reviewer from Frédéric Chapoton to Frédéric Chapoton, Nicolas M. Thiéry |
comment:18
Replying to @dcoudert:
Actually the code did not create a list: just an iterator over those edges. But it might well be that using an iterator induces some overhead.
A good reason :-)
Thanks! Positive review. |
Merged: sage-5.1.beta1 |
The Cartesian product of directed graphs does not work. For example
The result is a disconnected union of 4 points.
This should be a commutative square, with 4 edges.
CC: @rlmill @nathanncohen @dcoudert
Component: graph theory
Keywords: directed graph, product
Author: David Coudert
Reviewer: Frédéric Chapoton, Nicolas M. Thiéry
Merged: sage-5.1.beta1
Issue created by migration from https://trac.sagemath.org/ticket/12770
The text was updated successfully, but these errors were encountered: