Talk given at RubyConf AR 2014 - Buenos AIres
Our Daily GraphsWritten in Ruby and Neo4j
View Slide
Hola! / Oi! / Hi!• Hanneli - from Brazil• CodeMiner 42• Coffee (coffee, coffee, coffee, coffee, coffee,coffee), Pokémon, Lego and animals <3HIRING
We *WON’T* see here• Advanced graph theory• Neo4j complete guide• Java stuff (Neo4j is written in Java)• Social Networks classics example (eeeww)
Why graphs?In a Ruby Conference!
ExampleHow does Codeminer build dev teams?
ExampleHow does Codeminer build dev teams?MATCH
How many timeshave you madedrawings like these?
Some history• Euler• Statistics• Patterns/relationship• Dependencies• Routes
Persistence
PersistenceOne of the first CS subjects is…
Do you remember?QueueStackHashTreeGraphs
PersistenceWhat’s the first storing system we study!into databases class?a. Queueb. Stackc. Hashd. Treee. None
Have you ever thought about it?
When did I notice that?
Hydropower modelling
Hydropower in Brazil
Wanna represent hydropower mapinto relational modelHYDROPOWER_PLANTlocale:floatcapacity:floatname:floatproviding_city_id:CITYneighbor_id:HYDROPOWER_PLANTpopulation:int
FUUUUUUU….
FUUUUUUU….• According to population, how should I createhydropower plants neighbors?• If one plant shuts off, which one should replace itwithout causing damage to the entire system?• How should I avoid underuse?• Monitoring?
Double Fail….
‘Unleraned?'
Look at this
Similar?
Graphs orienteddatabasesBecause not all data need to live in tables
Neo4j
Our plants into graphsItaipu!is_neighborItálatitude:33.43longitude:32:33capacity:1400latitude:43.43longitude:56:33capacity:700line_voltage:230
Our plants into graphsItaipu!is_neighborItálatitude:33.43longitude:32:33capacity:1400latitude:43.43longitude:56:33capacity:700line_voltage:230NodeRelationshipAttributesindex
Visual representationItaipu!Itá
Our plants into graphsItaipu!feedsFoz doiguaçulatitude:33.43longitude:32:33capacity:1400population:265000feedsCuritibapopulation:1700000
How many people does Itaipu feed?
Traversal - SearchItaipu!feedsFoz doiguaçulatitude:33.43longitude:32:33capacity:1400population:265000feedsCuritibapopulation:1700000
Cypher
Neo4j with Ruby <3neo4j.rbActive Record
Neo4j with Ruby <3REST API WrapperNeography
Neo4j - When should I not use?
Neo4j - When should I not use?• NoSQL Hater?• Searches - BE CAREFUL (depth x width)• Cloud• Node Monitor• Infra (backup)• Limted RAM
Obrigada!@hannelita[email protected]Questions?