Fix Non Recursive Depth First Search#2207
Conversation
|
Hey @marcoscannabrava, TravisCI finished with status TravisBuddy Request Identifier: 5861b5e0-c832-11ea-ab6f-3547fdb4f9a3 |
|
Hey @marcoscannabrava, TravisCI finished with status TravisBuddy Request Identifier: de28a1b0-c838-11ea-ab6f-3547fdb4f9a3 |
|
Does the doctring at the top of the file match the new code? |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
@marcoscannabrava This file was changed by recent merges (spacing, indentation etc., the content is the same I think) so now it conflicts your older version. You can either rebase, or refork and start over. This might help with rebase. @cclauss The docstring at the top is strange. First it says it calls itself recursively, then it says "Instead of recursively calling with a node...", then provides pseudo code that IS recursively calling with a node, then the actual code does not. It's very very confusing. That docstring should be rewritten or removed I think. |
82b29de to
2b76ab3
Compare
|
@marcoscannabrava I see you got rid of the conflict. |
graphs/depth_first_search.py
Outdated
| :param graph: directed graph in dictionary format | ||
| :param vertex: starting vertex as a string | ||
| :returns: the trace of the search | ||
| >>> G = { "A": ["B", "C", "D"], "B": ["A", "D", "E"], | ||
| ... "C": ["A", "F"], "D": ["B", "D"], "E": ["B", "F"], | ||
| ... "F": ["C", "E", "G"], "G": ["F"] } | ||
| >>> start = "A" | ||
| >>> output_G = list({'A', 'B', 'C', 'D', 'E', 'F', 'G'}) | ||
| >>> all(x in output_G for x in list(depth_first_search(G, "A"))) | ||
| True | ||
| >>> all(x in output_G for x in list(depth_first_search(G, "G"))) | ||
| True |
There was a problem hiding this comment.
No particular reason. Just unindented them.
Co-authored-by: Christian Clauss <cclauss@me.com>
* Fix Non Recursive Depth First Search * Unindent docstring * Reindent docstring by 1 space Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: Christian Clauss <cclauss@me.com>
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.