1)For an existing graph, I want to perform label propagation algorithm.
To simplify it furthur, for a given vertex V; update a specific property for all vertices connected to V directly or transitively via any edge.
Currently I am using the query-
graph.traversal().V(vertex).repeat(both()).until(cyclicPath()).both().dedup().property("label","new_label")
Is there a faster way to do this?
2)Also once I have update the data, I want to get all vertices whose label have been updated from the above command and write it back to a relational database as well.
For that I am doing
Iterator iter = graph.traversal().V(vertex).repeat(both()).until(cyclicPath()).both().dedup().valueMap("property_key", "label");
Then iterating over each vertex that I received I write it back to the database.
At times if the graph is too dense, I get a heap size exceeded exception in trying to store all graphs in iterator.
Is there any optimised way to run this faster?
My code is in java.
Any help or suggestions, very greatly appreciated. Thank you in advance.