Vertex hashmaps
Hi, I'm looking to copy subgraphs, if there are better practices for this in general, please let me know
I'm currently looking at emitting a subtree, then creating new vertices, storing a mapping of the original to the copy, and reusing this mapping to build out the relationships for the copied vertices.
I'm not sure how I should be doing this, currently I'm trying to use the aggregate step to store the original/copy pairs, but I'm not sure how to select nodes from this in future steps.
I'd appreciate any suggestions or help around these kind of operations, thanks
I've been able to do this by building edges between the original nodes and the copies and traversing them, but I'm not sure if this is a typical pattern or there may be better approaches
I'm currently looking at emitting a subtree, then creating new vertices, storing a mapping of the original to the copy, and reusing this mapping to build out the relationships for the copied vertices.
I'm not sure how I should be doing this, currently I'm trying to use the aggregate step to store the original/copy pairs, but I'm not sure how to select nodes from this in future steps.
I'd appreciate any suggestions or help around these kind of operations, thanks
I've been able to do this by building edges between the original nodes and the copies and traversing them, but I'm not sure if this is a typical pattern or there may be better approaches
Solution
since you tagged this question with javascript i think that
aggregate() is probably your best approach. in java, you would probably prefer subgraph() because it gives you a Graph representation which you could in turn run Gremlin on and as a result is quite convenient. we hope to see better support for subgraph() in javascript (and other language variants) in future releases.