-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Return edges from Depth_First_Search #27636
Comments
comment:1
Can anyone tell me the importance of this requirement? |
comment:2
Replying to @Rithesh17:
Hello, I have already worked on this for BFS(#18855 comment:1) and that ticket is now closed. So, it would be good to implement a similar thing for DFS. |
comment:3
As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9). |
comment:4
I am willing to work on this ticket. I think, one way to implement this is to use a list of visited nodes(in the same sequence in which they were visited) to get the connecting node for the edge. Or is there a better way? Should I do |
comment:6
Look at http://doc.sagemath.org/html/en/developer/manual_git.html#pushing-your-changes-to-a-ticket for more details on how to start creating branches. |
comment:8
I have made the required changes to get edges as output and committed it. And added the test as well. |
Commit: |
comment:9
The method you propose is not good: instead of a linear time algorithm, you propose a quadratic time algorithm. I suggest to distinguish 2 cases, the aloe one that reports vertices, and the new one to report edges. - (default ``False``)
+ (default: ``False``) |
comment:11
Replying to @dcoudert:
Implemented this. Please review. New commits:
|
comment:12
- - ``edges`` -- boolean (default ``False``); whether to return the edges
+ - ``edges`` -- boolean (default: ``False``); whether to return the edges
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:14
Replying to @dcoudert:
I've corrected this and in several other places as well.
Fixed
fixed
fixed |
comment:15
In general, it is better to not touch parts of the code that have nothing to do with the method you are currently modifying. This is to avoid possible conflicts with other tickets. A better approach is to open a dedicated ticket. Also, you have done partial corrections only like - - ``quotient_matrix`` - (default False) if True, and
+ - ``quotient_matrix`` - (default: ``False``) if True, and a better formatting is + - ``quotient_matrix`` -- (default: ``False``); if ``True``, and Next, a simpler version could be - for i in range(len(queue)):
- v, d = queue[i]
- queue[i] = (None, v, d)
+ queue = [(None, v, d) for v, d in queue] |
comment:16
Ok. I'll remove the changes I made to other function documentations and add the simplification you mentioned. Should I open a ticket regarding making the documentation in this file uniform? |
New commits:
|
New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:23
I've added the tests but I've found a potential bug:
Obviously 5 is not getting printed since there is no edge involving 5 even though it is visited. Should't we still somehow indicate that 5 was visited? If so how? As in please suggest some appropriate output for that case and I'll make the necessary changes. |
comment:24
What you observed is a normal behavior, so it's OK I guess. |
comment:25
Replying to @dcoudert:
I added it in my local repository but I don't see how the output between starting from [0] or from [0, 5] should be any different? It is a circuit so the DFS from 0 just covers every vertex. For checking this case, shouldn't I make a graph with two disjoint trees for a DFS? |
comment:26
Right, you can take |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:28
Replying to @dcoudert:
Done. Please review. |
Reviewer: David Coudert |
comment:29
Please add your full name in the authors field |
comment:31
I'm not sure why the status changed to needs work again after positive review. Is it because of the author name adding? Or do I need to run all doctests on this before sending PR? edit: I'll try rebasing with current develop because I got an issue in another ticket. |
Author: Sagnik Dey |
comment:32
I just rebased it and ran doctests in src/sage again. 3 error cropped up which I don;t think is related to my change really. Can you please confirm what this is:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:34
The error reported in #comment:32 has nothing to do with this ticket. I have it when testing the develop branch of 9.1.beta6. You can open a new ticket to fix it (check first that no ticket has already been open for this purpose), and we will send a message on sage-devel. I'm setting this ticket to needs review to check if the patchbot reports something. |
comment:35
Replying to @dcoudert:
I created a new ticket #29272 since I couldn't find any other ticket referencing this (I searched by keyword). Also, I think the patchbot has finished the testing. |
comment:36
LGTM |
Changed branch from u/gh-SagnikDey92/return_edges_from_depth_first_search to |
There is no current way to get edges from the depth_first_search traversal of the graph.
Add an extra parameter 'get_edges' to return the edges from the depth_first_search.
Component: graph theory
Author: Sagnik Dey
Branch/Commit:
f480fd0
Reviewer: David Coudert
Issue created by migration from https://trac.sagemath.org/ticket/27636
The text was updated successfully, but these errors were encountered: