Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Our Daily Graphs written in Ruby and Neo4j

83a8147c3c83c22e1e421c3420e768f9?s=47 hannelita
October 24, 2014

Our Daily Graphs written in Ruby and Neo4j

Talk given at RubyConf AR 2014 - Buenos AIres

83a8147c3c83c22e1e421c3420e768f9?s=128

hannelita

October 24, 2014
Tweet

More Decks by hannelita

Other Decks in Technology

Transcript

  1. Our Daily Graphs Written in Ruby and Neo4j

  2. Hola! / Oi! / Hi! • Hanneli - from Brazil

    • CodeMiner 42 • Coffee (coffee, coffee, coffee, coffee, coffee, coffee), Pokémon, Lego and animals <3 HIRING
  3. We *WON’T* see here • Advanced graph theory • Neo4j

    complete guide • Java stuff (Neo4j is written in Java) • Social Networks classics example (eeeww)
  4. Why graphs? In a Ruby Conference!

  5. Example How does Codeminer build dev teams?

  6. Example How does Codeminer build dev teams? MATCH

  7. How many times have you made drawings like these?

  8. Some history • Euler • Statistics • Patterns/relationship • Dependencies

    • Routes
  9. Persistence

  10. Persistence

  11. Persistence One of the first CS subjects is…

  12. Do you remember? Queue Stack Hash Tree Graphs

  13. Persistence What’s the first storing system we study! into databases

    class? a. Queue b. Stack c. Hash d. Tree e. None
  14. Persistence

  15. Have you ever thought about it?

  16. When did I notice that?

  17. Hydropower modelling

  18. Hydropower in Brazil

  19. Wanna represent hydropower map into relational model HYDROPOWER_PLANT locale:float capacity:float

    name:float providing_city_id:CITY neighbor_id:HYDROPOWER_PLANT population:int
  20. FUUUUUUU….

  21. FUUUUUUU…. • According to population, how should I create hydropower

    plants neighbors? • If one plant shuts off, which one should replace it without causing damage to the entire system? • How should I avoid underuse? • Monitoring?
  22. Double Fail….

  23. ‘Unleraned?'

  24. Look at this

  25. Similar?

  26. Similar?

  27. Graphs oriented databases Because not all data need to live

    in tables
  28. Neo4j

  29. Our plants into graphs Itaipu! is_neighbor Itá latitude:33.43 longitude:32:33 capacity:1400

    latitude:43.43 longitude:56:33 capacity:700 line_voltage:230
  30. Our plants into graphs Itaipu! is_neighbor Itá latitude:33.43 longitude:32:33 capacity:1400

    latitude:43.43 longitude:56:33 capacity:700 line_voltage:230 Node Relationship Attributes index
  31. Visual representation Itaipu! Itá

  32. Our plants into graphs Itaipu! feeds Foz do iguaçu latitude:33.43

    longitude:32:33 capacity:1400 population:265000 feeds Curitiba population:1700000
  33. How many people does Itaipu feed?

  34. Traversal - Search Itaipu! feeds Foz do iguaçu latitude:33.43 longitude:32:33

    capacity:1400 population:265000 feeds Curitiba population:1700000
  35. Cypher

  36. Neo4j with Ruby <3 neo4j.rb Active Record

  37. Neo4j with Ruby <3 REST API Wrapper Neography

  38. Neo4j - When should I not use?

  39. Neo4j - When should I not use? • NoSQL Hater?

    • Searches - BE CAREFUL (depth x width) • Cloud • Node Monitor • Infra (backup) • Limted RAM
  40. Obrigada! @hannelita hannelita@gmail.com Questions?