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
49
ネットワークグラフを作成する
kunou
July 06, 2018
Tweet
Share
More Decks by kunou
See All by kunou
GANについて
kunou
0
430
AIか何かについて.pdf
kunou
0
32
Pythonを書いていておーマジかーと感じたあれこれ
kunou
1
720
Rubyで機械学習してみた
kunou
1
1.1k
ZIP!!
kunou
0
170
zip
kunou
0
510
Make Mouse
kunou
0
630
RubyのProcのあれをこうしました
kunou
0
93
esm lt Clojure like threading macro
kunou
0
420
Other Decks in Technology
See All in Technology
Godot Engineについて調べてみた
unsoluble_sugar
0
410
Amazon Route 53, 待ちに待った TLSAレコードのサポート開始
kenichinakamura
0
170
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
.NET 最新アップデート ~ AI とクラウド時代のアプリモダナイゼーション
chack411
0
200
Building Scalable Backend Services with Firebase
wisdommatt
0
110
My small contributions - Fujiwara Tech Conference 2025
ijin
0
1.4k
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
160
2025年の挑戦 コーポレートエンジニアの技術広報/techpr5
nishiuma
0
140
【JAWS-UG大阪 reInvent reCap LT大会 サンバが始まったら強制終了】“1分”で初めてのソロ参戦reInventを数字で振り返りながら反省する
ttelltte
0
140
Azureの開発で辛いところ
re3turn
0
240
Accessibility Inspectorを活用した アプリのアクセシビリティ向上方法
hinakko
0
180
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Speed Design
sergeychernyshev
25
740
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.5k
Unsuck your backbone
ammeep
669
57k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Gamification - CAS2011
davidbonilla
80
5.1k
Building Adaptive Systems
keathley
38
2.4k
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Ͱ)