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

Random remarks #3

Closed
gdalle opened this issue Apr 30, 2023 · 2 comments
Closed

Random remarks #3

gdalle opened this issue Apr 30, 2023 · 2 comments

Comments

@gdalle
Copy link

gdalle commented Apr 30, 2023

Hey there @SteffenPL,

Taking a very quick look at your code, here are a few things I thought of. We can always structure them later.

  • I would separate the various structs into different files to make it clearer which methods belong to which
  • Why do you need a new edge type?
  • Assertions can be deactivated, better to throw errors for invalid inputs
  • Is edge addition type-stable? I'm not sure what the callbacks are for but they could lead to performance issues (see the infamous https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-captured)
@SteffenPL
Copy link
Owner

Thanks for looking at the project! I'll implement 1/ and 3/ directly.

About 4/, it seemed to be type-stable here, but I will check it again.

About 2/, you are actually right. My initial idea of the implementation needed a new edge type, but the more I simplified it, the less it was needed anymore and I did not realize that. I can use the simple edge type from Graphs.jl and define a new init_edge function to call minmax in the case of undirected graphs.

@SteffenPL
Copy link
Owner

SteffenPL commented May 1, 2023

Hi, I implemented 1-3.

Regarding the add_edge operation, that seems to be type stable. (The difference to the example from the Julia docs is that the callbacks are only used internally, but they have a finite lifetime. I think Julia seems smart enough not to capture anything here...) Therefore, I think 4 is also fine.

If it would be instable, then also this test would fail:

@testset "allocations with edge data" begin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants