Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Kevin Bacon Number with Neo4j
Search
kawakubox
August 17, 2016
Programming
2.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Kevin Bacon Number with Neo4j
グラフデータベースのNeo4jを使って、ケビン・ベーコン数の検証をしたLTのスライド
kawakubox
August 17, 2016
More Decks by kawakubox
See All by kawakubox
speee-eng-mtg-20160810
kawakubox
0
1.6k
speee-kaigi-160629
kawakubox
1
2.9k
Other Decks in Programming
See All in Programming
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
450
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
210
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
170
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
460
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Abbi's Birthday
coloredviolet
4
10k
A better future with KSS
kneath
240
18k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Music & Morning Musume
bryan
48
7.4k
Transcript
Neo4j Ͱ έϏϯɾϕʔ ίϯʹ৮ΕͯΈΔ 2016.8.17 (Wed)
• ໊લ: Տٱอ ൟ࢙ (kawakubox) • ւ֎ࣄۀ෦ Eng • !
ϑϧϚϥιϯࢦͯ͠ ΦϑΟε to ࣗ ͷ Extreme ୀ ࣾͳΜ͔ͰτϨʔχϯάதɻ
ಥવͰ͕͢ɺέϏϯɾϕ ʔίϯͬͯͬͯ·͢ ͔ʁ
None
ΞϝϦΧ߹ऺࠃͷആ༏ ओͳग़ԋ࡞ • ʰτϨϚʔζʱ • ʰΞϙϩ13ʱ • ʰX-MEN: ϑΝʔετɾδΣωϨʔγϣϯʱ etc
etc ...
ͰɺέϏϯɾϕʔίϯ ͬͯͬͯ·͔͢ʁ
έϏϯɾϕʔίϯͱ өըആ༏ͷڞԋؔͷʮڑʯΛέϰΟϯɾϕʔίϯΛىʹ ܭଌ͞ΕΔ ϕʔίϯຊਓ͕ʮϋϦουͷશһ͕ࣗͷڞԋऀ͔ɺڞԋऀ ͷڞԋऀͩʯͱ͍͏झࢫͷൃݴͨ͜͠ͱ͕͖͔͚ͬ — wikipedia
έϏϯɾϕʔίϯͷਤ Ͱඳ͘ͱ
None
࣍ͷִͨΓ ࣍ͷִͨΓʢΖ͘͡ͷͩͨΓɺSix Degrees of Separationʣ ͱɺશͯͷਓࣄ6εςοϓҎͰܨ͕͍ͬͯͯɺ༑ୡͷ ༑ୡ…Λհͯ͠ੈքதͷਓʑͱؒతͳΓ߹͍ʹͳΔ͜ͱ͕ Ͱ͖Δɺͱ͍͏Ծઆɻ — wikipedia
• SNSͳͲͷԼʹͳ͍ͬͯΔԾઆ
·͞ʹάϥϑDBʹͱͬͯ࠷దͷͳͷͰɺNeo4jͷੑೳݕূ ݉Ͷͯେ͖ΊͳσʔλΛೖͯ͠ΈΑ͏
σʔλϞσϧ
None
Node : Person • ϓϩύςΟ • person_id • name
Relation : KNOWS • ϓϩύςΟͳ͠
લఏ • 1ਓ࠷100ਓͱΓ߹͍Ͱ͋Δ
1,000,000ਓͷੈք σʔλೖ࣌ؒ(csv import) IMPORT DONE in 7m 6s 292ms. Imported:
1000000 nodes 200000000 relationships 2000000 properties
1,000,000ਓͷੈք ϗοϓͷ # ࢼߦճ : 1,065ճ {0=>0, 1=>0, 2=>43, 3=>1021,
4=>1, 5=>0}
10,000,000ਓͷੈք IMPORT DONE in 3h 5m 4s 706ms. Imported: 10000000
nodes 2000000000 relationships 20000000 properties
10,000,000ਓͷੈք ϗοϓͷ # ࢼߦճ : 1,065ճ {0=>0, 1=>0, 2=>4, 3=>592,
4=>469, 5=>0}
֬ೝ༻ͷCYPHERΫΤϦ MATCH (a:Person {person_id: {i}}), (b:Person {person_id: {j}}), p =
shortestPath((a)-[*..6]->(b)) RETURN length(p) as len
CYPHERΫΤϦͷ༁ MATCH // person_id = i Λ࣋ͭϊʔυΛऔಘ͠ɺ a ͱ͢Δ (a:Person
{person_id: {i}}), // person_id = j Λ࣋ͭϊʔυΛऔಘ͠ɺ b ͱ͢Δ (b:Person {person_id: {j}}), // a ͱ b ͷϗοϓ͕ 6 ҎͷͷͰɺ࠷ܦ࿏Λऔಘ͢Δ p = shortestPath((a)-[*..6]->(b)) RETURN // ࠷ܦ࿏ͷ͞(len)Λฦ٫͢Δ length(p) as len
126,000,000ਓͷੈքʢຊʣ -rw-r--r-- 1 kawakubox staff 21M 8 16 22:09 person_1000000.csv
-rw-r--r-- 1 kawakubox staff 221M 8 17 01:31 person_10000000.csv -rw-r--r-- 1 kawakubox staff 2.6G 8 16 22:12 relation_1000000.csv -rw-r--r-- 1 kawakubox staff 2.9G 8 17 01:34 person_japan.csv -rw-r--r-- 1 kawakubox staff 29G 8 17 03:53 relation_10000000.csv ϦϨʔγϣϯೖ༻σʔλ͕ 10,000,000 ͷ࣌Ͱ 30G ͋ͬͨ ͷͰɺσʔλ࡞࣌Ͱஅ೦ɺɺɺ
ࠓճͬͯΈͯͷؾ͖ • ϊʔυ͕ 10,000,000 Ͱɺదʹ index షΕɺprimary ݕ ࡧࣗମ 0ms
͘Β͍Ͱฦͬͯ͘Δ • ϦϨʔγϣϯ͕ 2,000,000,000 ͘Β͍ʹͳΔͱɺ͘ͳͬͯ ͘Δ (5sec ͘Β͍) • ͍ΫΤϦɺCPUར༻ 300% ͑ͱ͔ฏؾͰ͢Δ • Enterprise൛ͬͯͷΫϥελϦϯάͳΜ͔ࢼͯ͠Έͨ ͍
END