Graphs.jl icon indicating copy to clipboard operation
Graphs.jl copied to clipboard

added iterators for dfs and bfs

Open kylebeggs opened this issue 3 years ago • 29 comments
trafficstars

Adds support to iterate through the nodes in a graph in a depth-first or breadth-first manner. (see #106 )

kylebeggs avatar Aug 16 '22 18:08 kylebeggs

The checks are failing because of other parts of the code, not what is included in this PR. I'm still kinda new to this - what is the procedure when this happens?

kylebeggs avatar Aug 16 '22 22:08 kylebeggs

The checks are failing because of other parts of the code, not what is included in this PR. I'm still kinda new to this - what is the procedure when this happens?

From the error logs, it looks as if in your PR you used some names that where already used for something else:

WARNING: using Traversals.tree in module Main conflicts with an existing identifier.
`` 

simonschoelly avatar Aug 17 '22 06:08 simonschoelly

Ah, I see. I fixed the issue. Tests still show one error but it seems to be in a completely different module

kylebeggs avatar Aug 17 '22 13:08 kylebeggs

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 97.30%. Comparing base (afb8245) to head (10e7c6e). Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #163      +/-   ##
==========================================
+ Coverage   97.28%   97.30%   +0.02%     
==========================================
  Files         118      120       +2     
  Lines        6876     6944      +68     
==========================================
+ Hits         6689     6757      +68     
  Misses        187      187              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 18 '22 15:08 codecov[bot]

Ah, I see. I fixed the issue. Tests still show one error but it seems to be in a completely different module

Indeed - apparently the tests are failing in Julia v1.8 -> I will need to investigate here

simonschoelly avatar Aug 19 '22 14:08 simonschoelly

@kylebeggs If you rebase/merge the lastest master in your branch, the tests should pass now.

simonschoelly avatar Aug 21 '22 00:08 simonschoelly

@simonschoelly @etiennedeg I am taking a new approach to this taking into account some of the comments. I converted this PR to a draft in the meantime

kylebeggs avatar Sep 19 '22 13:09 kylebeggs

@thchr thanks for the suggestion. @simonschoelly @etiennedeg I am opening this back up as I have made some changes. Please review and lets all work together to come up with something to get us started with iterators in this package.

kylebeggs avatar Mar 15 '23 13:03 kylebeggs

This is very cool, one thing I want to suggest for the bfs part is that to apply the optimization I already applied here: https://github.com/JuliaGraphs/Graphs.jl/pull/250.

Tortar avatar Oct 21 '23 17:10 Tortar

@Tortar Thanks for the comments. Unfortunately, I don't have time to apply your suggestions right now. Please, make the changes if you are able to. Hopefully one day we can merge this.

kylebeggs avatar Nov 02 '23 02:11 kylebeggs

@kylebeggs I'm willing to go on with this, I think we have two options: you can list me as a collaborator of your fork so that I can update this branch, otherwise I will need to superseed this pr. I would prefer the first option so that you appear as the main author

Tortar avatar Nov 05 '23 13:11 Tortar

@Tortar sounds great! I'll add you as a collaborator..

kylebeggs avatar Nov 05 '23 20:11 kylebeggs

@kylebeggs if we give up on multiple sources for now and focus on a single source, is this in a reviewable / mergeable state?

gdalle avatar Jan 29 '24 12:01 gdalle

Hi @gdalle working on extending to multiple sources at the moment, shouldn't be too hard, sorry for the delay, but I forgot about this

Tortar avatar Jan 29 '24 13:01 Tortar

okay, now multi source versions for bfs and dfs should work, I don't know the Kruskal algorithm so I didn't update it. Also, tests are failing because of jet complaining about the kruskal implementation

Tortar avatar Jan 29 '24 15:01 Tortar

my idea would be to put that algorithm in a separate PR and finish the work for the simpler cases of bfs and dfs, what do you think?

Tortar avatar Jan 29 '24 15:01 Tortar

I agree, let's do BFS and DFS first, they're much more widely used

gdalle avatar Jan 29 '24 15:01 gdalle

I removed the Kruskal implementation, if you can @kylebeggs I think you should open the new PR though since you made it

Tortar avatar Jan 29 '24 18:01 Tortar

@Tortar I'm sorry, I'm confused. Why do we need to make a new PR? This one reflects the removal of Kruskal?

kylebeggs avatar Jan 29 '24 19:01 kylebeggs

I removed it from here so that we can finish the work for bfs/dfs, so maybe not to forget about the kruskal implementation here: https://github.com/JuliaGraphs/Graphs.jl/pull/163/commits/72c6840dfd75cedc1d1a3286986bd19f3e522b48 you can open up a new pr

Tortar avatar Jan 29 '24 19:01 Tortar

anyway @gdalle it should be ready for review!

Tortar avatar Jan 29 '24 19:01 Tortar

@Tortar I see. You have done a lot here, please feel free to make that PR.

kylebeggs avatar Jan 30 '24 01:01 kylebeggs

Thank you for the PR! I cleaned up the code a little bit and ensured type stability in the structs

gdalle avatar Mar 05 '24 10:03 gdalle

Thanks @gdalle for the help! But tests are now failing somehow

Tortar avatar Mar 05 '24 12:03 Tortar

Yeah sorry I'll fix it in a moment

gdalle avatar Mar 05 '24 14:03 gdalle

tests are fixed now

gdalle avatar Mar 06 '24 07:03 gdalle

Great to see so much progress on this @Tortar @gdalle. What else is needed to get this merged? There has been a lot of activity, so it is a little difficult to see what exactly is left to do?

kylebeggs avatar Mar 06 '24 16:03 kylebeggs

Essentially address my unresolved comments above: adding more tests and some comments / docstrings describing the logic to make reviewing easier

gdalle avatar Mar 06 '24 16:03 gdalle

I tried to address all review comments by @gdalle, probably docstrings can be improved but hopefully should be okay nonetheless

Tortar avatar Apr 28 '24 15:04 Tortar

Huge thanks to @Tortar !!

kylebeggs avatar May 05 '24 22:05 kylebeggs