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
graph,graph/{encoding/dot,internal/set,topo,traverse}: remove intsets imports #68
Conversation
It turns out even changing the less hairy community package cases (non-multiplex) is problematic as the iteration order impacts on the algorithm (recall that it is a randomised algorithm so this might be expected). This suggests at least an interim approach. That commit will come soon. |
The approach to maintaining an iterator required for the multiplex cases is handled by a The impact on performance is not terrible:
except for the fact that without consistent sort order of the nodes (which
This can be fixed later. |
@@ -306,6 +308,36 @@ func (d *dense) TakeMin(p *int) bool { | |||
return true | |||
} | |||
|
|||
// slice is a sparse integer set iterator. | |||
type slice struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type reads as community.slice
which does not communicate its use clearly. Perhaps change from slice
to intSetSlice
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this. It's a minTaker that is a slice.
From what I can tell, the change looks good to me. When reviewing the change, and especially as you commented on the performance impact of changing from That could make the chance less intrusive and still maintain a good performance. What are your thoughts? |
I had a look at the code for intsets and it's not trivial to make it a |
What you will notice though is that in the bigids branch, the parts of community that handle this deal with ids that are in |
This is a first step towards allowing
int64
ID values and addresses the simple-to-handle cases.Another PR for the more hairy community package will follow when I figure out a good approach; the problem is that
intsets.Sparse
iterates via a stateful method, which allows a nice method-based approach to handle subset iteration, versus complete set iteration without filling a complete set for the complete set case.set.Ints
cannot do this because of limitations withrange
. Suggestions welcomed.@vladimir-ch @mewmew Please take a look.