Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ネットワークグラフを作成する
Search
kunou
July 06, 2018
Technology
0
47
ネットワークグラフを作成する
kunou
July 06, 2018
Tweet
Share
More Decks by kunou
See All by kunou
GANについて
kunou
0
420
AIか何かについて.pdf
kunou
0
30
Pythonを書いていておーマジかーと感じたあれこれ
kunou
1
720
Rubyで機械学習してみた
kunou
1
1.1k
ZIP!!
kunou
0
170
zip
kunou
0
500
Make Mouse
kunou
0
630
RubyのProcのあれをこうしました
kunou
0
92
esm lt Clojure like threading macro
kunou
0
420
Other Decks in Technology
See All in Technology
Lexical Analysis
shigashiyama
1
150
AGIについてChatGPTに聞いてみた
blueb
0
130
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
いざ、BSC討伐の旅
nikinusu
2
780
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
300
Terraform Stacks入門 #HashiTalks
msato
0
350
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
【Startup CTO of the Year 2024 / Audience Award】アセンド取締役CTO 丹羽健
niwatakeru
0
980
The Rise of LLMOps
asei
7
1.4k
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
160
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Done Done
chrislema
181
16k
Practical Orchestrator
shlominoach
186
10k
Facilitating Awesome Meetings
lara
50
6.1k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Producing Creativity
orderedlist
PRO
341
39k
Git: the NoSQL Database
bkeepers
PRO
427
64k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Scaling GitHub
holman
458
140k
A Tale of Four Properties
chriscoyier
156
23k
Transcript
ωοτϫʔΫάϥϑΛੜ ͢Δ(ClojureͰ) 2018/6/15 ITS-training-camp
ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) ͜͏͍͏ਤΛੜ͠·͢
ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) ͜͏͍͏ਤΛੜ͠·͢
DEMO ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ίʔυશମ (ns gen-network.core) (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as
str]) (require '[loom.graph :as lg]) (require '[loom.io :as lio]) (def data-text “data.txt") (def keywords ["a" "b" "c" "d"]) (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) (defn word-relation [key list] (->> list (filter (fn [words] (some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (defn main [] (->> keywords (reduce (fn [accum keyword] (concat accum (word-relation keyword data-list))) []) )) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) (main) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ $ cat data.txt a, b c, d a, b
a, b a, b a, e c, d a, e a, d c, b e, d ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ) JavaͷΫϥεΛΠϯϙʔτ
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) clojure.stringΛ͑ΔΑ͏ʹ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) FileReaderΛॳظԽ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) BuffReaderΛॳظԽ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ߦ͝ͱʹ͚Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ϑΝΠϧΛಡΈࠐΉ (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as str]) (def
data-text "data.txt") (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ߦΛ``,``Ͱ͚ͯVectorʹ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (word-relation "a" data-list) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1]) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => ([“a” “b”] [“c” “d”] [“a” “b”] [“a” “b”] [“a” “b”] [“a” “e”] [“c” “d”] [“a” “e”] [“a” “d”] [“c” “b”] [“e" “d"]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (["a" "b"] ["a" "b"] ["a" "b"] ["a" "b"] ["a" "e"] ["a" "e"] ["a" "d"]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (("b") ("b") ("b") ("b") ("e") ("e") ("d")) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => ("b" "b" "b" "b" "e" "e" "d") ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => {"b" ["b" "b" "b" "b"], "e" ["e" "e"], "d" ["d"]} ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ಡΈࠐΜͩ݁Ռ͔ΒΈ߹ΘͤճΛ͑Δ (defn word-relation [key list] (->> list (filter (fn [words]
(some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) => (["a" "b" 4] ["a" "e" 2] ["a" "d" 1] [“b" "a" 4] ["b" "c" 1] ["c" "d" 2] ["c" "b" 1] [“d" "c" 2] ["d" "a" 1] ["d" "e" 1]) ͜͜·Ͱ࣮ߦ͢Δ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) άϥϑσʔλΛ࡞ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ޙϥΠϒϥϦͷྗͰ (defn main [] (->> keywords (reduce (fn [accum keyword]
(concat accum (word-relation keyword data-list))) []) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) ஔΛࢦఆͯ͠ඳը ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
ίʔυશମ (ns gen-network.core) (import '(java.io BufferedReader FileReader)) (require '[clojure.string :as
str]) (require '[loom.graph :as lg]) (require '[loom.io :as lio]) (def data-text “data.txt") (def keywords ["a" "b" "c" "d"]) (def data-list (->> (FileReader. data-text) (BufferedReader.) (line-seq) (map #(str/split % #", ")))) (defn word-relation [key list] (->> list (filter (fn [words] (some #(= % key) words))) (map (fn [words] (remove #(= key %) words))) (flatten) (group-by #(identity %)) ((fn [group] (map #(vector key (first %) (count (second %))) group))))) (defn main [] (->> keywords (reduce (fn [accum keyword] (concat accum (word-relation keyword data-list))) []) )) ; (remove (fn [x] (<= (nth x 2) 4))) (apply lg/weighted-graph) ((fn [graph] (lio/view graph :alg :fdp))))) (main) ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
·ͱΊ ͪΐͬͱͨ͠πʔϧΛ࡞Δͱ͖ͳͲɺؔܕݴޠΛ͏ͱ͘εο ΩϦ͔͚·͢ɻ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)
·ͱΊ ͪΐͬͱͨ͠πʔϧΛ࡞Δͱ͖ͳͲɺؔܕݴޠΛ͏ͱ͘εο ΩϦ͔͚·͢ɻ RubyPythonΛͬͯ͘ॻ͚·͚͢ͲͶɻ ωοτϫʔΫάϥϑΛੜ͢Δ(ClojureͰ)