neo4j

29
Peter Neubauer Neo Technology #neo4j @peterneubauer [email protected]

Upload: university-of-new-south-wales

Post on 13-Jul-2015

464 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Neo4j

Peter NeubauerNeo Technology

#neo4j@[email protected]

Page 2: Neo4j

Neo4j – what is it?

Java based, embeddable, data-localGPL/AGPLACID, JTA compliantIndexing framework24/7 since 2003High Availability clustering supportGreat communityTinkerpop pipes processing stack

Page 3: Neo4j

The Neo4j model: Property GraphCore abstractions:

NodesRelationships between nodesProperties on both

name = “Emil”age = 29sex = “yes”

type = KNOWStime = 4 years

type = carvendor = “SAAB”model = “95 Aero”

11 22

33

Page 4: Neo4j

Building a node space (core API)GraphDatabaseService graphDb = ... // Get factory

// Create Thomas 'Neo' AndersonNode mrAnderson = graphDb.createNode();mrAnderson.setProperty( "name", "Thomas Anderson" );mrAnderson.setProperty( "age", 29 );

// Create MorpheusNode morpheus = graphDb.createNode();morpheus.setProperty( "name", "Morpheus" );morpheus.setProperty( "rank", "Captain" );morpheus.setProperty( "occupation", "Total bad ass" );

// Create a relationship representing that they know each othermrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );// ...create Trinity, Cypher, Agent Smith, Architect similarly

Page 5: Neo4j

Building a node spaceGraphDatabaseService graphDb = ... // Get factoryTransaction tx = graphdb.beginTx();

// Create Thomas 'Neo' AndersonNode mrAnderson = graphDb.createNode();mrAnderson.setProperty( "name", "Thomas Anderson" );mrAnderson.setProperty( "age", 29 );

// Create MorpheusNode morpheus = graphDb.createNode();morpheus.setProperty( "name", "Morpheus" );morpheus.setProperty( "rank", "Captain" );morpheus.setProperty( "occupation", "Total bad ass" );

// Create a relationship representing that they know each othermrAnderson.createRelationshipTo( morpheus, RelTypes.KNOWS );// ...create Trinity, Cypher, Agent Smith, Architect similarlytx.commit();

Page 6: Neo4j

Code (2): Traversing a node space

// Instantiate a traverser that returns Mr Anderson's friendsTraverser friendsTraverser = mrAnderson.traverse(

Traverser.Order.BREADTH_FIRST,StopEvaluator.END_OF_GRAPH,ReturnableEvaluator.ALL_BUT_START_NODE,RelTypes.KNOWS,Direction.OUTGOING );

// Traverse the node space and print out the resultSystem.out.println( "Mr Anderson's friends:" );for ( Node friend : friendsTraverser ){

System.out.printf( "At depth %d => %s%n",friendsTraverser.currentPosition().getDepth(),friend.getProperty( "name" ) );

}

Page 7: Neo4j

Rubygem install neo4j

require ”rubygems”require 'neo4j'

class Person include Neo4j::NodeMixin property :name, :age, :occupation index :name has_n :friendsend

Neo4j::Transactoin.run do neo = Person.new :name=>'Neo', :age=>29 morpheus = Person.new :name=>'Morpheus', :occupation=>'badass' neo.friends << morpheusend

neo.friends.each {|p|...}

Page 8: Neo4j

Neo4j 1.3 news

GPL Community Edition128 Billion primitives address spaceMore graph algosShort string → longWeb visualizationGremlin 0.9 built-inHA improvements

Page 9: Neo4j

Web admin

Page 10: Neo4j

Neo4j High Availability

Page 11: Neo4j

Neo4j – what do do people with it?

Graphs over 1M nodesNetwork ManagementMaster Data ManagementSocialFinanceSpatialOther

BioinformaticsRDFRouting, LogisticsProduct config etc

Page 12: Neo4j

Call Data Records (CDR)Forming a (social) graphLocation basedPossible uses:

Find clusters (better plans)Build social connectionsFind influencers

Page 13: Neo4j

Financial data – fraud detection

name = “Mr Godfather”karma = veeeery-lowcash = more-than-you

11

amount = $1000

name = “Emil”cash = always-too-li'l

title = “ATM @ Wall St”id = 230918484233cash_left = 384204

33

1313

TRANSFER WITHDRAW

name = “The Tavern”lat = 1295238237long = 234823492

amount = $1000

name = ...

77

22

OWNS

DEPOSITTR

ANSF

ER

name = ...

4242

WITHDRAW

Page 14: Neo4j

Routing

Page 15: Neo4j

Social graphs

RecommendationsLocation based servicesInfluencersShortest path

Page 16: Neo4j

Recommendations and big graphsGlobal heuristics

Page rankLocal recommendations

Shortest pathsHammock functionsRandom walksDijkstra, A*, Shooting star etc

Page 17: Neo4j

Impact Analytics, CMDB, Network Management, Provisioning

Page 18: Neo4j

Impact Analytics, CMDB, Network Management, Provisioning

Page 19: Neo4j

Master Data Management

Page 20: Neo4j

Multiple indexes - GIS

Page 21: Neo4j

Neo4j dynamic layers

Layer1

Layer2

Layer3

GeometryEncoder

DynamicQuery

DynamicStyles

DynamicMeta-Inf

Connected domain data Neo4j Spatial GIS and Spatial stacks

Page 22: Neo4j

OpenStreetMap

Page 23: Neo4j

Network Topology analysis

Analytics of network coverage and frequenciesCell towersDrive dataInfrastructure

AnalyticsSpatial signal strengthAntenna placement and azimuthFrequency planningNetwork differences over timeReporting and charting

Page 24: Neo4j

Cell network analysis

Page 25: Neo4j

Cell network analysis

Page 26: Neo4j

Simulations (Energy market)

agents, markets, power plants, bids, substances, technologies

Page 27: Neo4j

Relevant research areasTraversals/Querying

Query optimization (Sameh)Parallel (BSP) and Local (Neo4j)Crossing shards during traversal (context etc)MultithreadedSubgraph matching (Mattias)

Graph shardingUpfront sharding utilsRuntime sharding algosPartial sharding/replication

Parallel garbage collection under high loadBig graph algos and heuristics

Page 28: Neo4j

Questions?

Image credit: lost again! Sorry :(

Page 29: Neo4j

http://neotechnology.com