Presented at Laracon US 2019
Graph Databases and LaravelDOTStheCONNECTINGLARACON US 2019KEITH DAMIANI
View Slide
Graph Databases and LaravelKEITH DAMIANIDOTStheCONNECTINGLARACON US 2019
KEITH DAMIANIPRINCIPAL PROGRAMMER!
"
What is a graph database?CONNECTING THE DOTS
What is a graph database?CONNECTING THE DOTSGraph DBs vs. relational DBsUse casesWriting queriesLaravel graph DBs
What is a graph database?CONNECTING THE DOTS© JACK MCDADE
© JACK MCDADE
Nodes"VERTICES"
Nodes"VERTICES""EDGES"Relationships
Keith'sFamilyTree
Keith'sFamilyTreeKeith
WAIT A MINUTE
WAIT A MINUTERELATIONAL DATABASES
WAIT A MINUTERELATIONAL DATABASES“ ”
L14th St./8th Ave. Union Square6th Ave.Washington SquareHouston St.1st Ave.L LKBBKBB
stationsid name1 14th St./8th Ave.2 6th Ave.3 Union Square4 1st Ave.5 Washington Square6 Houston St.linesid name1 32 43 54 L5 B6 Kline_stationid station_id line_id connected_to1 3 4 22 4 4 73 5 5 44 5 6 85 6 5 66 6 6 9
1735KALININGRAD
KÖNIGSBERG
© HISTORIC CITIES RESEARCH PROJECT / OZGUR TUFECKI
© HISTORIC CITIES RESEARCH PROJECT / OZGUR TUFECKINo sweat, I got this.
© HISTORIC CITIES RESEARCH PROJECT / OZGUR TUFECKINo sweat, I got this.e2.718281828459045
JOINS
What is a graph database?CONNECTING THE DOTSGraph DBs vs. relational DBsUse cases
Highly-connected dataTHE NATURE OF YOUR DATAHierarchical/tree-shaped
FRIEND-OF-A-FRIEND QUERYDepth Relational DB Neo4j Graph DB Records2 0.02 0.01 25003 30 0.17 110,0004 1,544 1.36 600,0005 Unfinished 2.13 800,000PERFORMANCE, IN SECONDS
Highly-connected dataTHE NATURE OF YOUR DATAHierarchical/tree-shapedMany-to-many and/or polymorphicSchema-less
Social networksCOMMON USE CASESReal-time product recommendationsSocial + Recommendation
Social networksCOMMON USE CASESReal-time product recommendationsWould you like to Join my ProfessionalNetwork?Social + Recommendation
Social networksCOMMON USE CASESReal-time product recommendationsSocial + RecommendationGeospatialGeospatial + Recommendation
Digital asset managementCOMMON USE CASES (MORE!)Textual analysis / searchPageRank searchFinancial / fraud detectionPublic policy / journalism
Disconnected dataBAD FITSBulk data scansAggregating across nodesWhen write speed is paramountBLOBs / large amounts of text
NEO4J.COM
OrientDBApache TinkerPopAmazon NeptuneJanusGraphArangoDB
CYPHER
CYPHER( )-[ ]->( )
CYPHER( )-[ ]->( )MATCH RETURN
CYPHERMATCH (me:User {name: 'Me'})
(DEMO TIME!)
NeoEloquentTHREE OPTIONS FOR LARAVEL
NeoEloquentTHREE OPTIONS FOR LARAVELGraphAware neo4j-php-client
NeoEloquentTHREE OPTIONS FOR LARAVELGraphAware neo4j-php-client¯\_(ツ)_/¯
VaporLaravel
Neo4Laravel
Larapals.com
! @keithdamianikeithdamiani.com