-
Notifications
You must be signed in to change notification settings - Fork 13
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
Adding multiple vertices with the same data #2
Comments
hi @Carpetfizz
but you still can do it, my suggestion is very simple:
hope that helps |
Thank you so much! I just copied and pasted the
Now, I'm trying to do the same for
But I'm not finding this to be the case. The edges in the graph keep increasing as I add more of the same edge. Consider the following
The My requirement is that the edge should be the same but the edge's data can be different. I'm using the graph to map geometric relationships between vertices, which can change. So, the edge (1, 2, data=x) and (1,2, data=y) should count as the same edge between (1, 2) but the data should get updated. Any advice on this would be appreciated. |
@Carpetfizz yeah I see. because we wanted to support multi-edges, i.e - multiple edges on the same two vertices, no two edges can be the same, even if they may be isomorphic, so you can override the under the hood, it serializes like this:
|
Thanks again for the response, I think I left out another requirement by accident. I do indeed want a directed multigraph, but multiple edges connecting the same two vertices will definitely contain different data. Will your above solution still work in this scenario? |
Hello,
Let's say I have a Vertex of the following form:
Vertex<MyClass> myVertex = new Vertex<>(myObject.getMessage());
In my program, it is possible for a Vertex with the same data to get
graph.addVertex()
'd. I want to be able to stop the graph from adding a Vertex if another one with the samedata
exists. I saw that theVertex.hashCode
is a function of some auto generated ID. If my data source is guaranteed to be unique elements, is it possible to make the hash a function of the data instead of a random ID ?Thanks for any advice.
The text was updated successfully, but these errors were encountered: