O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Presented by Grant Paton-Simpson
Word Puzzles with
Neo4j and Py2neo
Overview
●
Brief look at graph databases & Neo4j
●
Introduction to word transformation game
●
Getting suitable words
●
Add...
Graph Databases – a NoSQL option
http://neo4j.com/books/graph-databases/
NoSQL – when is it a good fit?
●
SQL has its origins in the 1970s
and may not be fresh and shiny
any more but ...
●
… we s...
https://twitter.com/edd/status/400190499585544192
Graph Databases
●
Graph databases much, much better for related data with:
– lots of different links between same nodes
– ...
Substantial Benefits
●
Massive performance benefits (going exponential as number
of links grows)
●
Structural harmony
– be...
Word transformations
●
Start with one word and get to
the other by single-letter
tranformations word-by-word
●
E.g. starti...
Puzzle taster
Get from 'sloven' to 'closed' in
no more than 5 steps
(there are 10 unique solutions)
sloven
?
closed
Getting a simple word list
●
How hard could it be?
●
Lesson #1 – scrabble lists and similar are useless – only want lists
...
Filtering words
●
Needed to turn é to e
●
Needed to eliminate possessives e.g. cat's (as used in the phrase “the
cat's whi...
For each word, identifying words different
by one letter only
Disclaimer: the code worked but probably some super-smart op...
Adding data to Neo4j
●
Create nodes and relationships
●
Lots of room for optimisations
●
Only need to build database once ...
Py2neo and Cypher
Cypher Syntax as ASCII Art (Really!)
Word Word
ONE_OFF
(Word) -[ONE_OFF]->(Word)
Cypher Syntax as ASCII Art (Really!)
Word Word
ONE_OFF
(Word) -[ONE_OFF]->(Word)
How cool is this?
Example Output
Matching chart
Live Demo – Suggestions for Start Word
“sloven” to “closed” solution(s)
Resources
●
Neo4j
– http://neo4j.com/books/graph-databases/
– http://neo4j.com/graphacademy/
– http://graphgist.neo4j.com/...
About Catalyst
Próximos SlideShares
Carregando em…5
×

de

Word Puzzles with Neo4j and Py2neo Slide 1 Word Puzzles with Neo4j and Py2neo Slide 2 Word Puzzles with Neo4j and Py2neo Slide 3 Word Puzzles with Neo4j and Py2neo Slide 4 Word Puzzles with Neo4j and Py2neo Slide 5 Word Puzzles with Neo4j and Py2neo Slide 6 Word Puzzles with Neo4j and Py2neo Slide 7 Word Puzzles with Neo4j and Py2neo Slide 8 Word Puzzles with Neo4j and Py2neo Slide 9 Word Puzzles with Neo4j and Py2neo Slide 10 Word Puzzles with Neo4j and Py2neo Slide 11 Word Puzzles with Neo4j and Py2neo Slide 12 Word Puzzles with Neo4j and Py2neo Slide 13 Word Puzzles with Neo4j and Py2neo Slide 14 Word Puzzles with Neo4j and Py2neo Slide 15 Word Puzzles with Neo4j and Py2neo Slide 16 Word Puzzles with Neo4j and Py2neo Slide 17 Word Puzzles with Neo4j and Py2neo Slide 18 Word Puzzles with Neo4j and Py2neo Slide 19 Word Puzzles with Neo4j and Py2neo Slide 20 Word Puzzles with Neo4j and Py2neo Slide 21 Word Puzzles with Neo4j and Py2neo Slide 22
Próximos SlideShares
Round pegs and square holes
Avançar
Transfira para ler offline e ver em ecrã inteiro.

1 gostou

Compartilhar

Baixar para ler offline

Word Puzzles with Neo4j and Py2neo

Baixar para ler offline

Neo4j is a graph database (nodes and relationships) and is the perfect fit for some types of problem. Within that domain Neo4j is much, much faster than SQL and easier to query. Py2neo is a Python binding to Neo4j. The live presentation showed how to create word transformation puzzles e.g. getting from "stores" to "slaked" by one latter transformations where each intermediate step is a valid word. One solution is "stores"->"stored"->"stared"->"staked"->"slaked".

Audiolivros relacionados

Gratuito durante 30 dias do Scribd

Ver tudo

Word Puzzles with Neo4j and Py2neo

  1. 1. Presented by Grant Paton-Simpson Word Puzzles with Neo4j and Py2neo
  2. 2. Overview ● Brief look at graph databases & Neo4j ● Introduction to word transformation game ● Getting suitable words ● Adding words and relationships into Neo4j ● Querying graph data to generate puzzles
  3. 3. Graph Databases – a NoSQL option http://neo4j.com/books/graph-databases/
  4. 4. NoSQL – when is it a good fit? ● SQL has its origins in the 1970s and may not be fresh and shiny any more but ... ● … we shouldn't choose NoSQL for reasons of fashion. ● Venerable SQL often a better choice for standard hierarchies e.g. countries that have cities that have suburbs etc
  5. 5. https://twitter.com/edd/status/400190499585544192
  6. 6. Graph Databases ● Graph databases much, much better for related data with: – lots of different links between same nodes – different numbers of links between nodes e.g. 3 hops to one peer and 7 hops to another – lots of peer-to-peer links
  7. 7. Substantial Benefits ● Massive performance benefits (going exponential as number of links grows) ● Structural harmony – between structure of data and structure of data storage (what you draw on the whiteboard might look very similar to how you data is actually structured) – between questions of data and query language used to answer them
  8. 8. Word transformations ● Start with one word and get to the other by single-letter tranformations word-by-word ● E.g. starting with “stores” get to “slaked” – BTW there are 96 alternative ways 5 moves or less stores stored stared staked slaked
  9. 9. Puzzle taster Get from 'sloven' to 'closed' in no more than 5 steps (there are 10 unique solutions) sloven ? closed
  10. 10. Getting a simple word list ● How hard could it be? ● Lesson #1 – scrabble lists and similar are useless – only want lists with standard words otherwise puzzles too hard ● Lesson #2 – have to decide about taboo/profane words ● Lesson #3 – the number of words affects the number of ONE_LETTER_DIFF relationships a lot ● Lesson #4 – clever optimisation not needed if restricting self to ordinary words SCOWL (Spell Checker Oriented Word Lists) http://wordlist.aspell.net/
  11. 11. Filtering words ● Needed to turn é to e ● Needed to eliminate possessives e.g. cat's (as used in the phrase “the cat's whiskers”) ● Needed to leave out capitalised words
  12. 12. For each word, identifying words different by one letter only Disclaimer: the code worked but probably some super-smart optimisations would be possible involving n-dimensional space or something
  13. 13. Adding data to Neo4j ● Create nodes and relationships ● Lots of room for optimisations ● Only need to build database once so 15 minutes is not worth reducing ● My Neo4j and Py2neo is beginner level but I was able to solve my problem
  14. 14. Py2neo and Cypher
  15. 15. Cypher Syntax as ASCII Art (Really!) Word Word ONE_OFF (Word) -[ONE_OFF]->(Word)
  16. 16. Cypher Syntax as ASCII Art (Really!) Word Word ONE_OFF (Word) -[ONE_OFF]->(Word) How cool is this?
  17. 17. Example Output
  18. 18. Matching chart
  19. 19. Live Demo – Suggestions for Start Word
  20. 20. “sloven” to “closed” solution(s)
  21. 21. Resources ● Neo4j – http://neo4j.com/books/graph-databases/ – http://neo4j.com/graphacademy/ – http://graphgist.neo4j.com/#!/gists – https://www.youtube.com/channel/UCvze3hU6OZBkB1vkhH2lH9Q ● Py2neo – http://py2neo.org/2.0/ ● SCOWL – http://wordlist.aspell.net/
  22. 22. About Catalyst
  • MarcusBrutus

    Mar. 22, 2016

Neo4j is a graph database (nodes and relationships) and is the perfect fit for some types of problem. Within that domain Neo4j is much, much faster than SQL and easier to query. Py2neo is a Python binding to Neo4j. The live presentation showed how to create word transformation puzzles e.g. getting from "stores" to "slaked" by one latter transformations where each intermediate step is a valid word. One solution is "stores"->"stored"->"stared"->"staked"->"slaked".

Vistos

Vistos totais

728

No Slideshare

0

De incorporações

0

Número de incorporações

4

Ações

Baixados

9

Compartilhados

0

Comentários

0

Curtir

1

×