Add possibility to create graphs with duplicate nodes #53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For some graphs, nodes can be duplicated because those nodes can represent the same entity in different namespace without it being an issue.
For now, Pyyed doesn't allow such a feature. With in mind the fact that the default behavior of Pyyed must remain the same, I made some changes to the code to allow duplicates given specific options. Of course, a better design is possible if by default duplicates are allowed, but this is not my choice to make as I'm not the main developer of this package.
To allow this, one has to define the graph with the allow_duplicates keyword. Then to add edges between those nodes, you need to use the add_edges_by_obj instead of the add_edges for the nodes that have duplicates because you don't have the node_id even if it's see, as it's automatic.
Here is an example to showcase how to do a graph with duplicate with the new code this branch proposes: