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
430
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
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
Snykで始めるセキュリティ担当者とSREと開発者が楽になる脆弱性対応 / Getting started with Snyk Vulnerability Response
yamaguchitk333
2
190
なぜCodeceptJSを選んだか
goataka
0
160
.NET 9 のパフォーマンス改善
nenonaninu
0
980
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
LINEヤフーのフロントエンド組織・体制の紹介【24年12月】
lycorp_recruit_jp
0
530
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
220
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
200
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.3k
LINE Developersプロダクト(LIFF/LINE Login)におけるフロントエンド開発
lycorptech_jp
PRO
0
120
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
510
Featured
See All Featured
Thoughts on Productivity
jonyablonski
67
4.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
How to Ace a Technical Interview
jacobian
276
23k
Navigating Team Friction
lara
183
15k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
Optimising Largest Contentful Paint
csswizardry
33
3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
It's Worth the Effort
3n
183
28k
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Ͱ)