2

I have a Graph based database like Neo4j or Giraph with say existing 50 vertices and some edges linking them together.

Now i want to introduce a new Vertex - X into the Graph. However the Vertex needs to run a similarity algo against all of the other nodes. The node/nodes with which the similarity score is the highest will form the new edges of the Graph.

My question - 1 - Is this possible to do in Giraph/Neo4j? 2 - Any reference link that you can provide for the implementation of this?

Thanks, Manish

myloginid
  • 1,463
  • 2
  • 22
  • 37

1 Answers1

1

Yes it is possible, e.g. imagine your nodes have a numeric value property:

MATCH (n:Label)
WITH abs(n.value-{new_value}) as delta,n
ORDER BY delta DESC LIMIT 1
CREATE (m:Label {value:{new_value})-[:LINKED]->(n)
Michael Hunger
  • 41,339
  • 3
  • 57
  • 80
  • Just a additional question.. In calculating the abs(n.value-{new_value}), Can we use a Python or R code to compare the 2 values and implement functions like Levenshtein or Hamming Distance Algos – myloginid May 04 '15 at 05:24