Guest User

clustering coefficient

a guest
Apr 5th, 2016
98
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [source,cypher]
  2. ----
  3. create (_16:`Person` {`name`:"c0"})
  4. create (_17:`Person`)
  5. create (_18:`Person`)
  6. create (_19:`Person`)
  7. create (_20:`Person` {`name`:"c1"})
  8. create (_21:`Person`)
  9. create (_22:`Person`)
  10. create (_23:`Person`)
  11. create (_24:`Person` {`name`:"c2"})
  12. create (_25:`Person`)
  13. create (_26:`Person`)
  14. create (_27:`Person`)
  15. create (_28:`Person` {`name`:"c3"})
  16. create (_29:`Person`)
  17. create (_30:`Person`)
  18. create (_31:`Person`)
  19. create _16-[:`KNOWS`]->_19
  20. create _16-[:`KNOWS`]->_17
  21. create _16-[:`KNOWS`]->_18
  22. create _20-[:`KNOWS`]->_22
  23. create _20-[:`KNOWS`]->_23
  24. create _20-[:`KNOWS`]->_21
  25. create _21-[:`KNOWS`]->_22
  26. create _24-[:`KNOWS`]->_26
  27. create _24-[:`KNOWS`]->_27
  28. create _24-[:`KNOWS`]->_25
  29. create _25-[:`KNOWS`]->_26
  30. create _25-[:`KNOWS`]->_27
  31. create _28-[:`KNOWS`]->_29
  32. create _28-[:`KNOWS`]->_30
  33. create _28-[:`KNOWS`]->_31
  34. create _29-[:`KNOWS`]->_30
  35. create _29-[:`KNOWS`]->_31
  36. create _30-[:`KNOWS`]->_31
  37. ----
  38.  
  39. Query returning wrong results (comparing with https://en.wikipedia.org/wiki/Clustering_coefficient#Local_clustering_coefficient)
  40.  
  41. [source,cypher]
  42. ----
  43. MATCH (a)-[:KNOWS]-()-[r:KNOWS]-()-[:KNOWS]-(a)
  44. WHERE exists(a.name)
  45. WITH a, count(distinct r) AS connected_neighbours
  46. WHERE connected_neighbours>1
  47. RETURN a.name, toFloat(connected_neighbours)/(connected_neighbours*(connected_neighbours-1))
  48. ----
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×