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
kargoの魅力について伝える
magisystem0408
0
200
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
170
20241214_WACATE2024冬_テスト設計技法をチョット俯瞰してみよう
kzsuzuki
3
440
UI State設計とテスト方針
rmakiyama
2
460
なぜCodeceptJSを選んだか
goataka
0
160
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
マルチプロダクト開発の現場でAWS Security Hubを1年以上運用して得た教訓
muziyoshiz
2
2.2k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
権威ドキュメントで振り返る2024 #年忘れセキュリティ2024
hirotomotaguchi
2
740
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
A designer walks into a library…
pauljervisheath
204
24k
Fireside Chat
paigeccino
34
3.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Designing Experiences People Love
moore
138
23k
RailsConf 2023
tenderlove
29
940
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
The Cost Of JavaScript in 2023
addyosmani
45
7k
The Invisible Side of Design
smashingmag
298
50k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
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Ͱ)