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
What happened to the generics? #6
Comments
I am also curious -- coming from the blog post here I was expecting generics as well. And my planned data will probably not be Edit: Okay, so all nodes were instead changed to node indices (usize) in this commit: f168055 . It doesn't seem like any built-in system exists to manipulate data according to node indices. I'm personally unsure whether lifetimes is a good reason to eliminate node data entirely, but it does potentially make it much more cache-friendly to access graphs. Also it might be a good idea to add in some traits for retrieving data by index. |
Good questions, and I can see how this might seem strange. For some insight into part of the problem, see #4. The original design forced a lifetime parameter onto the The main problem I hit is that you can't return a trait object (e.g., Iterator) from a trait method (yet). And the old I understand that work by the Rust team is in progress that could allow the return of trait objects from trait methods, and so it might be worth re-visiting when that makes it into stable. In the meantime, the current approach eliminates the lifetime parameter from Regarding what to do if nodes are not I haven't moved forward with this, partly because I'm able to avoid it without downside. See ChemCore, which is based on Gamma. It extends |
I think a LabeledGraph could be useful. Edit: After thinking about it for a bit, borrowing makes it so that it's definitely more convenient to have a separate HashMap that maps ids to values so that you could iterate over elements in a Graph while simultaneously modifying values. |
After review, it seems clear that the benefits of generic node ids don't yet outweigh the costs. Closing. |
I'm puzzled, because
gamma
0.5 defined theGraph
trait as generic over node and edge type.StableGraph
had similar generic parameters. But now in 0.8, those are all gone, and nodes seem to be hardcoded asusize
, even in theGraph
trait as well as inDefaultGraph
.I'm wondering what drove this change and what the recommended practice is to use
gamma
when the nodes are notusize
?Thanks!
The text was updated successfully, but these errors were encountered: