-
Notifications
You must be signed in to change notification settings - Fork 21
Allow simultaneous use of the primitive index and the custom index #4
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
Comments
I agree this would be a nice feature to have and I'd be inclined to go with the second option. Even in the second option, we'd have to disallow |
A minimal step would be adding a sentence like the last one in my comment above to the docstring. |
I'm not sure I follow you here. Do you mean that |
I was wrong, nevermind. I was thinking that you would have to disallow V as a vertex code, but AbstractGraphs are required to have integers as vertex codes. Yes, I think passing vertex labels wrapped in a type is would be a reasonable option. Maybe we can bikeshed the name? I'm not a big fan of abbreviations |
Well, I was thinking something like struct VertexIndex{T}
i::T
end
const V = VertexIndex That way you can use the full name in your method definitions, but the abbreviation when you are indexing. Otherwise things like g[VertexIndex(:a), VertexIndex(:b)] = "hello" would get a bit bulky. However, I'm kind of going around in circles on this as I think about it. It would be nice to be able to use bare symbols like As long I'm able to pick either the simple integer index or a custom index at the beginning of a project, after I've made that choice I would probably stick with that choice for all of my indexing operations for that project. So, in other words, the indexing status quo on master is probably fine. :) |
Ok, well, feel free to open a PR if you think this would be useful. |
Suppose I have a graph
g
with 2 nodes, which are labeled:a
and:b
by a custom vertex. It would be nice if I could freely mix my usage of the primitive index (the underlying integer index) and the custom index. For example, it would be nice if the following were allowed:I think in order for this to work, you would have to do one of the following:
Integer
s for the custom index.V(:a)
orV(2)
. (Then custom indices could still be integers.)The text was updated successfully, but these errors were encountered: