SlideShare a Scribd company logo
1 of 79
Download to read offline
G RA P H T H E O RY I N
P RACT I S E
D A V I D S I M O N S
@ S W A M W I T H T U R T L E S
W H O A M I ?
• David Simons
• @SwamWithTurtles
• github.com/
SwamWithTurtles
• Technical Lead at Softwire
and part-time hacker
• Statistician in a past life
T O S E E D ATA D O N E R I G H T
M Y PA S S I O N …
W H AT I S D ATA
D O N E R I G H T ?
• Choosing the right
database;
• Using the right
mathematical and
statistical techniques to
leverage its power
S Q L
• SQL has had 40 years of
academic set theory
applied to it…
• Let’s do the same with
neo4j!
T O D AY…
• Concepts in Graph Theory
• Theory;
• Use Cases;
• Implementation Details
• Reward: What shape is
the internet?
W H AT I S A G R A P H ?
G R A P H T H E O RY
W H AT I S A G R A P H ?
Taken from Jim Webber’s Dr. Who Dataset
W H AT I S A G R A P H ?
{ (V, E) : V = [n], E ⊆ V(2) }
W H AT I S A G R A P H ?
{ (V, E) : V = [n], E ⊆ V(2) }
Made up of two parts,
“V” and “E”
W H AT I S A G R A P H ?
{ (V, E) : V = [n], E ⊆ V(2) }
V is a set of n items
W H AT I S A G R A P H ?
Vertex Set
W H AT I S A G R A P H ?
{ (V, E) : V = [n], E ⊆ V(2) }
E is made up of pairs
of elements of V
(Ordered and
not necessarily distinct)
W H AT I S A G R A P H ?
Edge Set
G I V I N G R E A L
W O R L D
M E A N I N G S T O V
A N D E
W H A T I S G R A P H I C A L
M O D E L L I N G ?
B R I D G E S AT K Ö N I G S B E R G
B R I D G E S AT K Ö N I G S B E R G
V =
bits of land
E =
bridges
E L E C T I O N D ATA
E L E C T I O N D ATA
E L E C T I O N D ATA
E =
(e.g.) member of, held in,
stood in…
V =
elections, constituencies,
years, politicians and parties
W H E R E D O E S
N E O 4 J F I T I N ?
• Stores both the vertex set
and the edge set as first
class objects:
• Queryable
• Can store properties
• “Typed”
W H Y L E A R N
T H E T H E O RY ?
• Tells us what we can do
• Let’s us utilise many years
of academics
• Gives us a common
language
C A S E S T U D Y
T H E B R E A K D O W N …
T H E B R I T I S H
I S L E S
A G R A P H O F
W H AT I S A G R A P H ?
{ (V, E) : V = [n], E ⊆ V(2) }
W H AT I S A G R A P H ?
{ (V, E) :
V = Places of Interest,
E = Places that are connected}
T H E B R I T I S H I S L E S
L O N D O N
L A N D ’ S
E N D
O X F O R D
Y O R K
S T.
I V E S
T H E B R I T I S H I S L E S
L O N D O N
L A N D ’ S
E N D
O X F O R D
Y O R K
S T.
I V E S
P L A N A R I T Y
• A planar graph is one that
can be drawn on paper
with its edges crossing
• There are easy theories
that tell you when a graph
is planar
• Used for planning
construction of roads
C O N N E C T I V I T Y
• A graph is connected if
there is a path between
any two points
• A graph is k-connected if
you need to remove at
least k vertices to stop it
being connected
• Used for infrastructure
robustness studies
S PA N N I N G
T R E E
• A tree is a graph with no
loops
• A spanning tree is a
graph with tree with every
vertex connected
• Ensure resources flow
through a network
C O L O U R I N G
G R A P H T H E O RY
W E L I K E T H E
S I M P L E T H I N G S
I N L I F E
M A T H E M A T I C I A N S …
C O L O U R I N G
I N …
M A T H E M A T I C I A N S …
C O L O U R I N G
I N …
• Take your graph (V, E)
• Vertex Colouring
• Assign every vertex a
colour such that no two
adjacent vertices have
the same colour.
T H AT ’ S A L L V E RY
W E L L …
O R G A N I S I N G
S P O R T S
T O U R N A M E N T S
W H Y ?
O R G A N I S I N G
S P O R T S
T O U R N A M E N T S
• Graph Model
• V = all matches that
must be played
• E = a team is the same
across two matches
• Two vertices the same
colour => they can be
played simultaneously
O R G A N I S I N G S P O R T S T O U R N A M E N T S
O R G A N I S I N G S P O R T S T O U R N A M E N T S
O T H E R
U S E S …
• Mobile Phone Tower
frequency assignment
• V = mobile phone
towers
• E = towers so close
their waves will
interfere
• Colours = frequencies
O T H E R
U S E S …
• Solving SuDokus
• V = Squares on a
SuDoku grid
• E = Knowledge that
they must be different
numbers
• Colours = numbers 1
to 9
O T H E R U S E S …
http://watch.neo4j.org/video/74870401
Avoiding Deadlocks in Neo4j on Z-Platform
N O J AVA F R A M E W O R K …
Y E T !
R A N D O M G R A P H S
G R A P H T H E O RY
R A N D O M N E S S
S E E M S C A RY…
B U T WA I T…
R A N D O M N E S S
S E E M S C A RY…
• It can be!
• Someone should do a
talk about that…
• https://
www.youtube.com/
watch?v=rV9dqR0P0lQ
A graph with a fixed number of vertices, whose
edges are generated non-deterministically
U S E C A S E S
R A N D O M G R A P H S S T I L L H A V E …
S T U B B E D T E S T
D ATA
U S E C A S E S
S T U B B E D
T E S T D ATA
• Suppose you have a
method that coloured the
vertices of a graph…
• How could you test that?
S T U B B E D
T E S T D ATA
S T U B B E D D ATA S E T
A P P LY M E T H O D
A S S E RT T H AT:
* E V E RY N O D E H A S A
C O L O U R
* N O T W O A D J A C E N T
N O D E S S H A R E A
C O L O U R
S T U B B E D
T E S T D ATA
R A N D O M LY
G E N E R AT E D D ATA S E T
A P P LY M E T H O D
A S S E RT T H AT:
* E V E RY N O D E H A S A
C O L O U R
* N O T W O A D J A C E N T
N O D E S S H A R E A
C O L O U R
S I M U L AT I O N
A L G O R I T H M S
U S E C A S E S
- N A S D A Q . C O M
“solving a problem by performing a large number
of trail runs… and inferring a solution from the
collective results of the trial runs.”
W H Y
S I M U L AT I O N ?
• Modelling underlying
randomness
• Underlying question is
impossible (or hard) to
solve
• Trying to model something
of which we cannot have
full knowledge
A N D …
• It’s possible to use
randomness and always be
correct
• cf. ‘Probabilistic
Combinatorics’ by Paul
Erdős
H O W C A N W E
A C C O M P L I S H I T I N N E O 4 J ?
D I Y
I N T H E O RY …
D I Y
G R A P H A W A R E
I N P R A C T I S E …
G R A P H A W A R E
• “#1 Neo4j Consultancy”
• Open-sourced a lot of
projects under GPL3
including:
• TimeTree
• Reco
• Algorithms
G R A P H A W A R E
G R A P H A W A R E
A graph with a fixed number of vertices, whose
edges are generated non-deterministically
E R D Ő S - R E N Y I
• Take a graph with n vertices;
• For each pair of vertices, randomly connect them with
probability p
E R D Ő S - R E N Y I
I WA N T T O M O D E L
D ATA A B O U T
K E V I N B A C O N
B U T …
I WA N T T O M O D E L
D ATA A B O U T
S P R E A D O F H I V
B U T …
I WA N T T O M O D E L
D ATA A B O U T
S C A L E F R E E
N E T W O R K S
B U T …
S C A L E F R E E
N E T W O R K S
• As the system grows, we
have:
• A small number of
highly connected
hubs
• A large number of
sparsely connected
nodes
S C A L E F R E E N E T W O R K S
H U B S S PA R S E N O D E S
A C T O R
C O W O R K E R S
Blockbuster stars,
like Kevin Bacon
Drama college graduate
#1828, #1829, #1830…
S P R E A D O F
H I V
Patriarchs
Less privileged society
members
C H E M I C A L
R E A C T I O N S
Catalysts Inert Chemicals
S C A L E F R E E N E T W O R K S
B A R A B A S I - A L B E R T
• Take a graph with 2 (connected) vertices
• Add vertices one at a time such that it is more likely to
add vertices to a node that is already connected
• Repeat until you have n vertices
B A R A B A S I - A L B E R T
Y O U R R E WA R D
R E M E M B E R …
I WA N T T O M O D E L
D ATA A B O U T
T H E I N T E R N E T
B U T …
O V E R V I E W
• Looking at graph theory
can give us a common
language
• Utilising techniques means
we don’t have to solve
problems from scratch each
time (e.g. colouring,
simulation)
• The internet looks like
Kevin Bacon’s career
A N Y Q U E ST I O N S ?
@ S W A M W I T H T U R T L E S
S W A M W I T H T U R T L E S . C O M

More Related Content

What's hot

Attributed Graph Matching of Planar Graphs
Attributed Graph Matching of Planar GraphsAttributed Graph Matching of Planar Graphs
Attributed Graph Matching of Planar GraphsRaül Arlàndez
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringSaurabh Kaushik
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsAshikur Rahman
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graphRounak Biswas
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory IntroductionMANISH T I
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applicationsManikanta satyala
 
Graph: Euler path and Euler circuit
Graph: Euler path and Euler circuitGraph: Euler path and Euler circuit
Graph: Euler path and Euler circuitLiwayway Memije-Cruz
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network systemManikanta satyala
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphsTech_MX
 
2.8 Absolute Value Functions
2.8 Absolute Value Functions2.8 Absolute Value Functions
2.8 Absolute Value Functionshisema01
 

What's hot (19)

Attributed Graph Matching of Planar Graphs
Attributed Graph Matching of Planar GraphsAttributed Graph Matching of Planar Graphs
Attributed Graph Matching of Planar Graphs
 
graph theory
graph theory graph theory
graph theory
 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Bipartite graph
Bipartite graphBipartite graph
Bipartite graph
 
Graph
GraphGraph
Graph
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
 
Matrix representation of graph
Matrix representation of graphMatrix representation of graph
Matrix representation of graph
 
Graph theory
Graph theory Graph theory
Graph theory
 
Graph Theory Introduction
Graph Theory IntroductionGraph Theory Introduction
Graph Theory Introduction
 
Graph theory presentation
Graph theory presentationGraph theory presentation
Graph theory presentation
 
Graph theory and its applications
Graph theory and its applicationsGraph theory and its applications
Graph theory and its applications
 
Graph: Euler path and Euler circuit
Graph: Euler path and Euler circuitGraph: Euler path and Euler circuit
Graph: Euler path and Euler circuit
 
Graph theory in network system
Graph theory in network systemGraph theory in network system
Graph theory in network system
 
Applications of graphs
Applications of graphsApplications of graphs
Applications of graphs
 
Presentation on graphs
Presentation on graphsPresentation on graphs
Presentation on graphs
 
Graph theory
Graph theoryGraph theory
Graph theory
 
2.8 Absolute Value Functions
2.8 Absolute Value Functions2.8 Absolute Value Functions
2.8 Absolute Value Functions
 

Viewers also liked

Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theoryTech_MX
 
Application of graph theory in drug design
Application of graph theory in drug designApplication of graph theory in drug design
Application of graph theory in drug designReihaneh Safavi
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and lifeMilan Joshi
 
Football and graph theory
Football and graph theoryFootball and graph theory
Football and graph theoryUmang Aggarwal
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookappasami
 
the bike map - a look into a practical application of graph theory
the bike map - a look into a practical application of graph theorythe bike map - a look into a practical application of graph theory
the bike map - a look into a practical application of graph theoryCharlie Hsu
 
GRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSGRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSManojit Chakraborty
 
Graph coloring and_applications
Graph coloring and_applicationsGraph coloring and_applications
Graph coloring and_applicationsmohammad alkhalil
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theoryChuckie Balbuena
 
Graph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering ProblemsGraph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering ProblemsSociety of Women Engineers
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1Tech_MX
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Darwish Ahmad
 
Chromatic graph theory
Chromatic graph theoryChromatic graph theory
Chromatic graph theoryjotasmall
 
Application in graph theory
Application in graph theoryApplication in graph theory
Application in graph theorysulaiman alfahad
 
Algorithms for Graph Coloring Problem
Algorithms for Graph Coloring ProblemAlgorithms for Graph Coloring Problem
Algorithms for Graph Coloring ProblemShengyi Wang
 

Viewers also liked (20)

Interesting applications of graph theory
Interesting applications of graph theoryInteresting applications of graph theory
Interesting applications of graph theory
 
Application of graph theory in drug design
Application of graph theory in drug designApplication of graph theory in drug design
Application of graph theory in drug design
 
Graph theory and life
Graph theory and lifeGraph theory and life
Graph theory and life
 
Football and graph theory
Football and graph theoryFootball and graph theory
Football and graph theory
 
CS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf bookCS6702 graph theory and applications notes pdf book
CS6702 graph theory and applications notes pdf book
 
the bike map - a look into a practical application of graph theory
the bike map - a look into a practical application of graph theorythe bike map - a look into a practical application of graph theory
the bike map - a look into a practical application of graph theory
 
GRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONSGRAPH COLORING AND ITS APPLICATIONS
GRAPH COLORING AND ITS APPLICATIONS
 
Graph coloring and_applications
Graph coloring and_applicationsGraph coloring and_applications
Graph coloring and_applications
 
introduction to graph theory
introduction to graph theoryintroduction to graph theory
introduction to graph theory
 
Graph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering ProblemsGraph Theory Application - Not Only for Engineering Problems
Graph Theory Application - Not Only for Engineering Problems
 
Graph
GraphGraph
Graph
 
Graph theory 1
Graph theory 1Graph theory 1
Graph theory 1
 
Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring Introduction to Graph and Graph Coloring
Introduction to Graph and Graph Coloring
 
Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Graph Theory and Databases
Graph Theory and DatabasesGraph Theory and Databases
Graph Theory and Databases
 
Chromatic graph theory
Chromatic graph theoryChromatic graph theory
Chromatic graph theory
 
Application in graph theory
Application in graph theoryApplication in graph theory
Application in graph theory
 
Graph coloring
Graph coloringGraph coloring
Graph coloring
 
Algorithms for Graph Coloring Problem
Algorithms for Graph Coloring ProblemAlgorithms for Graph Coloring Problem
Algorithms for Graph Coloring Problem
 
Graph coloring Algorithm
Graph coloring AlgorithmGraph coloring Algorithm
Graph coloring Algorithm
 

Similar to Graph theory in Practise

Choosing the right database
Choosing the right databaseChoosing the right database
Choosing the right databaseDavid Simons
 
Choosing the Right Database
Choosing the Right DatabaseChoosing the Right Database
Choosing the Right DatabaseDavid Simons
 
Statistical Programming with JavaScript
Statistical Programming with JavaScriptStatistical Programming with JavaScript
Statistical Programming with JavaScriptDavid Simons
 
Revision 2021 Introduction to the Demoscene
Revision 2021 Introduction to the DemosceneRevision 2021 Introduction to the Demoscene
Revision 2021 Introduction to the DemosceneReza Esmaili
 
Bristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLBristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLDavid Simons
 
Topological Data Analysis.pptx
Topological Data Analysis.pptxTopological Data Analysis.pptx
Topological Data Analysis.pptxColleen Farrelly
 
Map making for kids to help support #VisualizeNoMalaria
Map making for kids to help support #VisualizeNoMalariaMap making for kids to help support #VisualizeNoMalaria
Map making for kids to help support #VisualizeNoMalariaAnya A'Hearn
 
Ar. Bhumika Chudiwala portfolio
Ar. Bhumika Chudiwala portfolioAr. Bhumika Chudiwala portfolio
Ar. Bhumika Chudiwala portfolioBhumikaChudiwala
 
Bhumika chudiwala portfolio
Bhumika chudiwala portfolioBhumika chudiwala portfolio
Bhumika chudiwala portfolioBhumikaChudiwala
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at ScaleDavid Simons
 
Geometric Thinking - Mathematics 3
Geometric Thinking - Mathematics 3Geometric Thinking - Mathematics 3
Geometric Thinking - Mathematics 3Maxine Mae Ano-os
 
Programming != Writing Code
Programming != Writing CodeProgramming != Writing Code
Programming != Writing CodeGustavo Cunha
 
SEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsSEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsJonathon Hare
 
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)Jonathon Hare
 
On Cyber
On Cyber  On Cyber
On Cyber grugq
 
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitCanary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitAmazon Web Services
 

Similar to Graph theory in Practise (20)

Choosing the right database
Choosing the right databaseChoosing the right database
Choosing the right database
 
Choosing the Right Database
Choosing the Right DatabaseChoosing the Right Database
Choosing the Right Database
 
Statistical Programming with JavaScript
Statistical Programming with JavaScriptStatistical Programming with JavaScript
Statistical Programming with JavaScript
 
Revision 2021 Introduction to the Demoscene
Revision 2021 Introduction to the DemosceneRevision 2021 Introduction to the Demoscene
Revision 2021 Introduction to the Demoscene
 
Bristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQLBristol Uni - Use Cases of NoSQL
Bristol Uni - Use Cases of NoSQL
 
Agree to Disagree
Agree to DisagreeAgree to Disagree
Agree to Disagree
 
Graph Modelling
Graph ModellingGraph Modelling
Graph Modelling
 
Witchcraft
WitchcraftWitchcraft
Witchcraft
 
The Swift Architect
The Swift ArchitectThe Swift Architect
The Swift Architect
 
Topological Data Analysis.pptx
Topological Data Analysis.pptxTopological Data Analysis.pptx
Topological Data Analysis.pptx
 
Map making for kids to help support #VisualizeNoMalaria
Map making for kids to help support #VisualizeNoMalariaMap making for kids to help support #VisualizeNoMalaria
Map making for kids to help support #VisualizeNoMalaria
 
Ar. Bhumika Chudiwala portfolio
Ar. Bhumika Chudiwala portfolioAr. Bhumika Chudiwala portfolio
Ar. Bhumika Chudiwala portfolio
 
Bhumika chudiwala portfolio
Bhumika chudiwala portfolioBhumika chudiwala portfolio
Bhumika chudiwala portfolio
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at Scale
 
Geometric Thinking - Mathematics 3
Geometric Thinking - Mathematics 3Geometric Thinking - Mathematics 3
Geometric Thinking - Mathematics 3
 
Programming != Writing Code
Programming != Writing CodeProgramming != Writing Code
Programming != Writing Code
 
SEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia StreamsSEWM'14 keynote: Mining Events from Multimedia Streams
SEWM'14 keynote: Mining Events from Multimedia Streams
 
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)
Mining Events from Multimedia Streams (WAIS Research group seminar June 2014)
 
On Cyber
On Cyber  On Cyber
On Cyber
 
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitCanary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
 

More from David Simons

Four Architectural Patterns
Four Architectural Patterns Four Architectural Patterns
Four Architectural Patterns David Simons
 
Decoupled APIs through Microservices
Decoupled APIs through MicroservicesDecoupled APIs through Microservices
Decoupled APIs through MicroservicesDavid Simons
 
Non-Functional Requirements
Non-Functional RequirementsNon-Functional Requirements
Non-Functional RequirementsDavid Simons
 
High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-EndDavid Simons
 
Build Tools & Maven
Build Tools & MavenBuild Tools & Maven
Build Tools & MavenDavid Simons
 
Decoupled APIs through microservices
Decoupled APIs through microservicesDecoupled APIs through microservices
Decoupled APIs through microservicesDavid Simons
 
TDD: What is it good for?
TDD: What is it good for?TDD: What is it good for?
TDD: What is it good for?David Simons
 
Domain Driven Design: A Precis
Domain Driven Design: A PrecisDomain Driven Design: A Precis
Domain Driven Design: A PrecisDavid Simons
 
10 d bs in 30 minutes
10 d bs in 30 minutes10 d bs in 30 minutes
10 d bs in 30 minutesDavid Simons
 
Using Clojure to Marry Neo4j and Open Democracy
Using Clojure to Marry Neo4j and Open DemocracyUsing Clojure to Marry Neo4j and Open Democracy
Using Clojure to Marry Neo4j and Open DemocracyDavid Simons
 
Exploring Election Results with Neo4J
Exploring Election Results with Neo4JExploring Election Results with Neo4J
Exploring Election Results with Neo4JDavid Simons
 

More from David Simons (11)

Four Architectural Patterns
Four Architectural Patterns Four Architectural Patterns
Four Architectural Patterns
 
Decoupled APIs through Microservices
Decoupled APIs through MicroservicesDecoupled APIs through Microservices
Decoupled APIs through Microservices
 
Non-Functional Requirements
Non-Functional RequirementsNon-Functional Requirements
Non-Functional Requirements
 
High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-End
 
Build Tools & Maven
Build Tools & MavenBuild Tools & Maven
Build Tools & Maven
 
Decoupled APIs through microservices
Decoupled APIs through microservicesDecoupled APIs through microservices
Decoupled APIs through microservices
 
TDD: What is it good for?
TDD: What is it good for?TDD: What is it good for?
TDD: What is it good for?
 
Domain Driven Design: A Precis
Domain Driven Design: A PrecisDomain Driven Design: A Precis
Domain Driven Design: A Precis
 
10 d bs in 30 minutes
10 d bs in 30 minutes10 d bs in 30 minutes
10 d bs in 30 minutes
 
Using Clojure to Marry Neo4j and Open Democracy
Using Clojure to Marry Neo4j and Open DemocracyUsing Clojure to Marry Neo4j and Open Democracy
Using Clojure to Marry Neo4j and Open Democracy
 
Exploring Election Results with Neo4J
Exploring Election Results with Neo4JExploring Election Results with Neo4J
Exploring Election Results with Neo4J
 

Recently uploaded

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 

Recently uploaded (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 

Graph theory in Practise

  • 1. G RA P H T H E O RY I N P RACT I S E D A V I D S I M O N S @ S W A M W I T H T U R T L E S
  • 2. W H O A M I ? • David Simons • @SwamWithTurtles • github.com/ SwamWithTurtles • Technical Lead at Softwire and part-time hacker • Statistician in a past life
  • 3. T O S E E D ATA D O N E R I G H T M Y PA S S I O N …
  • 4. W H AT I S D ATA D O N E R I G H T ? • Choosing the right database; • Using the right mathematical and statistical techniques to leverage its power
  • 5. S Q L • SQL has had 40 years of academic set theory applied to it… • Let’s do the same with neo4j!
  • 6. T O D AY… • Concepts in Graph Theory • Theory; • Use Cases; • Implementation Details • Reward: What shape is the internet?
  • 7. W H AT I S A G R A P H ? G R A P H T H E O RY
  • 8. W H AT I S A G R A P H ? Taken from Jim Webber’s Dr. Who Dataset
  • 9. W H AT I S A G R A P H ? { (V, E) : V = [n], E ⊆ V(2) }
  • 10. W H AT I S A G R A P H ? { (V, E) : V = [n], E ⊆ V(2) } Made up of two parts, “V” and “E”
  • 11. W H AT I S A G R A P H ? { (V, E) : V = [n], E ⊆ V(2) } V is a set of n items
  • 12. W H AT I S A G R A P H ? Vertex Set
  • 13. W H AT I S A G R A P H ? { (V, E) : V = [n], E ⊆ V(2) } E is made up of pairs of elements of V (Ordered and not necessarily distinct)
  • 14. W H AT I S A G R A P H ? Edge Set
  • 15. G I V I N G R E A L W O R L D M E A N I N G S T O V A N D E W H A T I S G R A P H I C A L M O D E L L I N G ?
  • 16. B R I D G E S AT K Ö N I G S B E R G
  • 17. B R I D G E S AT K Ö N I G S B E R G V = bits of land E = bridges
  • 18. E L E C T I O N D ATA
  • 19. E L E C T I O N D ATA
  • 20. E L E C T I O N D ATA E = (e.g.) member of, held in, stood in… V = elections, constituencies, years, politicians and parties
  • 21. W H E R E D O E S N E O 4 J F I T I N ? • Stores both the vertex set and the edge set as first class objects: • Queryable • Can store properties • “Typed”
  • 22. W H Y L E A R N T H E T H E O RY ? • Tells us what we can do • Let’s us utilise many years of academics • Gives us a common language
  • 23. C A S E S T U D Y T H E B R E A K D O W N …
  • 24. T H E B R I T I S H I S L E S A G R A P H O F
  • 25. W H AT I S A G R A P H ? { (V, E) : V = [n], E ⊆ V(2) }
  • 26. W H AT I S A G R A P H ? { (V, E) : V = Places of Interest, E = Places that are connected}
  • 27. T H E B R I T I S H I S L E S L O N D O N L A N D ’ S E N D O X F O R D Y O R K S T. I V E S
  • 28. T H E B R I T I S H I S L E S L O N D O N L A N D ’ S E N D O X F O R D Y O R K S T. I V E S
  • 29. P L A N A R I T Y • A planar graph is one that can be drawn on paper with its edges crossing • There are easy theories that tell you when a graph is planar • Used for planning construction of roads
  • 30. C O N N E C T I V I T Y • A graph is connected if there is a path between any two points • A graph is k-connected if you need to remove at least k vertices to stop it being connected • Used for infrastructure robustness studies
  • 31. S PA N N I N G T R E E • A tree is a graph with no loops • A spanning tree is a graph with tree with every vertex connected • Ensure resources flow through a network
  • 32. C O L O U R I N G G R A P H T H E O RY
  • 33. W E L I K E T H E S I M P L E T H I N G S I N L I F E M A T H E M A T I C I A N S …
  • 34. C O L O U R I N G I N … M A T H E M A T I C I A N S …
  • 35. C O L O U R I N G I N … • Take your graph (V, E) • Vertex Colouring • Assign every vertex a colour such that no two adjacent vertices have the same colour.
  • 36. T H AT ’ S A L L V E RY W E L L …
  • 37. O R G A N I S I N G S P O R T S T O U R N A M E N T S W H Y ?
  • 38. O R G A N I S I N G S P O R T S T O U R N A M E N T S • Graph Model • V = all matches that must be played • E = a team is the same across two matches • Two vertices the same colour => they can be played simultaneously
  • 39. O R G A N I S I N G S P O R T S T O U R N A M E N T S
  • 40. O R G A N I S I N G S P O R T S T O U R N A M E N T S
  • 41. O T H E R U S E S … • Mobile Phone Tower frequency assignment • V = mobile phone towers • E = towers so close their waves will interfere • Colours = frequencies
  • 42. O T H E R U S E S … • Solving SuDokus • V = Squares on a SuDoku grid • E = Knowledge that they must be different numbers • Colours = numbers 1 to 9
  • 43. O T H E R U S E S … http://watch.neo4j.org/video/74870401 Avoiding Deadlocks in Neo4j on Z-Platform
  • 44. N O J AVA F R A M E W O R K … Y E T !
  • 45. R A N D O M G R A P H S G R A P H T H E O RY
  • 46. R A N D O M N E S S S E E M S C A RY… B U T WA I T…
  • 47. R A N D O M N E S S S E E M S C A RY… • It can be! • Someone should do a talk about that… • https:// www.youtube.com/ watch?v=rV9dqR0P0lQ
  • 48. A graph with a fixed number of vertices, whose edges are generated non-deterministically
  • 49. U S E C A S E S R A N D O M G R A P H S S T I L L H A V E …
  • 50. S T U B B E D T E S T D ATA U S E C A S E S
  • 51. S T U B B E D T E S T D ATA • Suppose you have a method that coloured the vertices of a graph… • How could you test that?
  • 52. S T U B B E D T E S T D ATA S T U B B E D D ATA S E T A P P LY M E T H O D A S S E RT T H AT: * E V E RY N O D E H A S A C O L O U R * N O T W O A D J A C E N T N O D E S S H A R E A C O L O U R
  • 53. S T U B B E D T E S T D ATA R A N D O M LY G E N E R AT E D D ATA S E T A P P LY M E T H O D A S S E RT T H AT: * E V E RY N O D E H A S A C O L O U R * N O T W O A D J A C E N T N O D E S S H A R E A C O L O U R
  • 54. S I M U L AT I O N A L G O R I T H M S U S E C A S E S
  • 55. - N A S D A Q . C O M “solving a problem by performing a large number of trail runs… and inferring a solution from the collective results of the trial runs.”
  • 56. W H Y S I M U L AT I O N ? • Modelling underlying randomness • Underlying question is impossible (or hard) to solve • Trying to model something of which we cannot have full knowledge
  • 57. A N D … • It’s possible to use randomness and always be correct • cf. ‘Probabilistic Combinatorics’ by Paul Erdős
  • 58. H O W C A N W E A C C O M P L I S H I T I N N E O 4 J ?
  • 59. D I Y I N T H E O RY …
  • 60. D I Y
  • 61. G R A P H A W A R E I N P R A C T I S E …
  • 62. G R A P H A W A R E • “#1 Neo4j Consultancy” • Open-sourced a lot of projects under GPL3 including: • TimeTree • Reco • Algorithms
  • 63. G R A P H A W A R E
  • 64. G R A P H A W A R E
  • 65. A graph with a fixed number of vertices, whose edges are generated non-deterministically
  • 66. E R D Ő S - R E N Y I • Take a graph with n vertices; • For each pair of vertices, randomly connect them with probability p
  • 67. E R D Ő S - R E N Y I
  • 68. I WA N T T O M O D E L D ATA A B O U T K E V I N B A C O N B U T …
  • 69. I WA N T T O M O D E L D ATA A B O U T S P R E A D O F H I V B U T …
  • 70. I WA N T T O M O D E L D ATA A B O U T S C A L E F R E E N E T W O R K S B U T …
  • 71. S C A L E F R E E N E T W O R K S • As the system grows, we have: • A small number of highly connected hubs • A large number of sparsely connected nodes
  • 72. S C A L E F R E E N E T W O R K S H U B S S PA R S E N O D E S A C T O R C O W O R K E R S Blockbuster stars, like Kevin Bacon Drama college graduate #1828, #1829, #1830… S P R E A D O F H I V Patriarchs Less privileged society members C H E M I C A L R E A C T I O N S Catalysts Inert Chemicals
  • 73. S C A L E F R E E N E T W O R K S
  • 74. B A R A B A S I - A L B E R T • Take a graph with 2 (connected) vertices • Add vertices one at a time such that it is more likely to add vertices to a node that is already connected • Repeat until you have n vertices
  • 75. B A R A B A S I - A L B E R T
  • 76. Y O U R R E WA R D R E M E M B E R …
  • 77. I WA N T T O M O D E L D ATA A B O U T T H E I N T E R N E T B U T …
  • 78. O V E R V I E W • Looking at graph theory can give us a common language • Utilising techniques means we don’t have to solve problems from scratch each time (e.g. colouring, simulation) • The internet looks like Kevin Bacon’s career
  • 79. A N Y Q U E ST I O N S ? @ S W A M W I T H T U R T L E S S W A M W I T H T U R T L E S . C O M