Hi, @Omar Ghoche Welcome to the Microsoft Q&A platform, thanks for posting the question
When you create your Gremlin API graph you define a partition key path. The value of the partition key for each vertex defines its logical partition. To create vertices in different partitions, you simply define each vertex with a different partition key value. You can then create an edge between the two vertices.
For example, assuming you have a graph with partition key path /pk, the following two traversals will each create a vertex in a different logical partition:
g.addV(‘vertex_label_1’).property(‘id’,’V1’).property(‘pk’,’pkX’)
g.addV(‘vertex_label_2’).property(‘id’,’V2’).property(‘pk’,’pkY’)
This traversal will then select the two existing vertices and create an edge between them:
g.V(‘V1’).has(‘pk’,’pkX’).addE(‘edge_label_12’).property(‘id’,’E12’).to(g.V(‘V2’).has(‘pk’,’pkY’))
Gremlin does not have transactions so it is possible that either of the addV steps may fail or that the sequentially executed traversals may beat the propagation delay for the new graph elements. If it’s possible that this can cause issues in your application, you can read this article on using idempotent queries to ensure the existence the graph elements:
I hope this information helps
Regards
Geetha