-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro_networks.html
371 lines (306 loc) · 15.3 KB
/
intro_networks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<title>MAT381E-Week 10: Creating and Visualizing Networks</title>
<meta charset="utf-8" />
<meta name="author" content="Gül İnan" />
<meta name="date" content="2022-01-10" />
<script src="intro_networks_files/header-attrs-2.11/header-attrs.js"></script>
<link href="intro_networks_files/remark-css-0.0.1/default.css" rel="stylesheet" />
<script src="intro_networks_files/fabric-4.3.1/fabric.min.js"></script>
<link href="intro_networks_files/xaringanExtra-scribble-0.0.1/scribble.css" rel="stylesheet" />
<script src="intro_networks_files/xaringanExtra-scribble-0.0.1/scribble.js"></script>
<script>document.addEventListener('DOMContentLoaded', function() { window.xeScribble = new Scribble({"pen_color":["#FF0000"],"pen_size":3,"eraser_size":30,"palette":[]}) })</script>
<link href="intro_networks_files/tile-view-0.2.6/tile-view.css" rel="stylesheet" />
<script src="intro_networks_files/tile-view-0.2.6/tile-view.js"></script>
<link href="intro_networks_files/animate.css-3.7.2/animate.xaringan.css" rel="stylesheet" />
<link href="intro_networks_files/tachyons-4.12.0/tachyons.min.css" rel="stylesheet" />
<link href="intro_networks_files/panelset-0.2.6/panelset.css" rel="stylesheet" />
<script src="intro_networks_files/panelset-0.2.6/panelset.js"></script>
<link rel="stylesheet" href="xaringan-themer.css" type="text/css" />
<link rel="stylesheet" href="assets/sydney-fonts.css" type="text/css" />
<link rel="stylesheet" href="assets/sydney.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: left, middle, my-title, title-slide
# MAT381E-Week 10: Creating and Visualizing Networks
### Gül İnan
### Department of Mathematics<br/>Istanbul Technical University
### January 10, 2022
---
class: left
# Outline
* What is Network?
* Examples
* Elements of a graph.
* The `tidygraph` and `ggraph` packages.
---
class: center, middle
Internet - the largest engineering project
<iframe width="700" height="500" src="https://www.youtube.com/embed/DdaElt6oP6w" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
[Source](https://www.opte.org/)
---
class: middle, center
<img src="images/internet.png" width="100%" height="100%" />
[Source](https://www.opte.org/about)
---
# Networks
- **Network analysis** is a suite of tools/methods developed to understand and analyze graphs in which several **vertices** (nodes) are connected each other through **edges**.
- With an example from Facebook network, we can consider **vertices** are **users** in the network and **edges** are links denoting **friendships**.
<img src="images/fb.jpeg" width="40%" height="40%" style="display: block; margin: auto;" />
---
#### Networks are everywhere!..
- In real life, network analysis helps us to understand complex relationships,
learn about behaviors, preferences, and trends.
---
#### Example: History
<style type="text/css">
.pull-left {
float: left;
width: 50%;
}
.pull-right {
float: right;
width: 50%;
}
</style>
.pull-left[
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">The exhibition “From Reformation to the Republic: Master Artists, Artist Students,&quot; which presents the interaction and change between generations through its focus on the relationship between masters and their apprentices, is at Sakıp Sabancı Museum. <a href="https://t.co/HEN9LhG9Yy">pic.twitter.com/HEN9LhG9Yy</a></p>&mdash; Sakıp Sabancı Müzesi (@SSabanciMuze) <a href="https://twitter.com/SSabanciMuze/status/1404764702618619913?ref_src=twsrc%5Etfw">June 15, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
]
.pull-right[
<blockquote class="twitter-tweet"><p lang="tr" dir="ltr">“Yüksek Osmanlı Ulemasının Mesleki ve Entelektüel İlişki Ağları ve Gruplaşmaları (1470-1650)” başlıklı projemizi nihayet bitirdik. İzninizle proje konusu hakkında kısa bir bilgi vermeyi ve birkaç örnek paylaşmayı istiyorum. <a href="https://t.co/PFJmfGV5j7">pic.twitter.com/PFJmfGV5j7</a></p>&mdash; Abdurrahman Atçıl (@aatcil) <a href="https://twitter.com/aatcil/status/1307022765363474435?ref_src=twsrc%5Etfw">September 18, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
]
---
#### Example: Job Connectivity in US
<img src="images/example.png" width="75%" height="100%" />
[Source](https://news.mit.edu/2021/job-connectivity-improves-resiliency-us-cities-0413)
---
#### Example continu'ed
- "Economists, policymakers, city planners, and companies have a strong interest in determining what factors contribute to healthy job markets, including what factors can help promote faster recovery after a shock, such as a major recession or the current Covid-19 pandemic."
- "Traditional modeling approaches in this realm have treated **workers as narrowly linked to specific jobs**.
- "In the real world, however, **jobs and sectors are linked**. <span style="color:red">Displaced workers can often transition to another job or sector requiring similar skills.</span>"
- "In this way, **job markets are much like ecosystems, where organisms are linked in a complex web of relationships**.
- "The authors modeled the relationships between jobs in cities across the United States. They predicted that **cities with jobs connected by overlapping skills and geography** would fare better in the face of economic shock than those without such networks."
- "They found that while cities of similar sizes would be affected similarly in the beginning phases of automation shocks, those with **well-connected job networks** would provide **better opportunities** for displaced workers to find other jobs."
- "This provides a buffer against widespread unemployment, and in some cases even leads to **more jobs** being created in the aftermath of the initial automation shock."
- A city like Burlington, Vermont, where job connectivity is high, would fare much better than Bloomington, Indiana, a similar-sized city where job connectivity is low.
- "The findings of the study suggest that **policymakers should consider job connectivity** when planning for the future of work in their regions, especially where automation is expected to replace large numbers of jobs."
- "Furthermore, in individual occupations, workers in jobs that are more “embedded” (connected to other jobs) in a region **earn higher wages** than similar workers in areas where those jobs are not as connected."
---
<style type="text/css">
.pull-left {
float: left;
width: 50%;
}
.pull-right {
float: right;
width: 50%;
}
</style>
#### Example: Open Syllabus Co-assignment Galaxy
- An interactive visualization of the underlying “co-assignment graph” – the network of relationships among books and articles formed by aggregating over all pairs of titles that appear together in the same courses.
.pull-left[
<img src="images/open_syllabus.png" width="100%" height="100%" />
]
.pull-right[
<img src="images/syl.png" width="100%" height="100%" />
]
[Source 1](https://galaxy.opensyllabus.org/#!viewport/5.5826/21.4688/-7.8283/0.0187)
[Source 2](https://blog.opensyllabus.org/galaxy-v2)
---
#### Example: Covid-19 Knowledge Graph
<img src="images/covidgraph.png" width="80%" height="100%" />
[Source](https://covidgraph.org/)
---
<style type="text/css">
.pull-left {
float: left;
width: 50%;
}
.pull-right {
float: right;
width: 50%;
}
</style>
#### Example: Covid-19 Bibliometric Analysis
.pull-left[
<img src="images/bib1.png" width="100%" height="100%" />
]
.pull-right[
<img src="images/bib2.png" width="100%" height="100%" />
]
[Source](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7396244/)
---
#### More at: Stanford Large Network Dataset Collection
<img src="images/stanford.png" width="100%" height="100%" />
[Source](https://snap.stanford.edu/data/index.html)
---
#### Popular Network Analysis Software
- Network analysis and visualization tools are mostly implemented either in a **specific software with a GUI** such as:
- [Gephi](https://gephi.org/) and
- [Cytoscape](https://cytoscape.org/)
- or in a **package/library within a programming language** such as:
- [igraph](https://igraph.org/) (R/Python library),
- [tidygraph](https://cran.r-project.org/web/packages/tidygraph/index.html) (R library),
- [ggraph](https://cran.r-project.org/web/packages/ggraph/index.html) (R library), and
- [NetworkX](https://networkx.org/) (Python library).
---
#### Graph Data Bases
- There also graph databases such as [Neo4j graph data base](https://neo4j.com/) which stores the relationship between data records in a graph format and allows users to do queries with complex connections.
<img src="images/nasa.png" width="100%" height="100%" />
---
- Some free books to download from web:
.pull-left[
<img src="images/graphds.png" width="80%" height="100%" />
[Source](https://neo4j.com/graph-data-science-for-dummies/?ref=home)
]
.pull-right[
<img src="images/graph_apache.png" width="80%" height="100%" />
[Source](https://neo4j.com/graph-data-science-for-dummies/?ref=home)
]
---
- Research Institutes
<a href="https://www.networkscienceinstitute.org/" target="_blank"><img src="images/northeastern.png" width="80%" height="100%" style="display: block; margin: auto;" /></a>
---
- More is available at:
- [Handbook of Graphs and Networks in People Analytics](https://ona-book.org/gitbook/).
- [Awesome list curated by François Briatte](https://github.com/briatte/awesome-network-analysis).
- [Katya Ognyanova's Network Visualization with R](http://kateto.net/network-visualization).
- [Douglas A. Luke, *A User’s Guide to Network Analysis in R* (2015)](http://www.springer.com/us/book/9783319238821).
- [Eric D. Kolaczyk and Gábor Csárdi's, Statistical Analysis of Network Data with R (2014)](http://www.springer.com/us/book/9781493909827).
---
# Attributions
- All images used in this slide are taken from the web.
- This lecture note is mainly developed by following sources:
- [Source 1](http://veronikarock.com/teaching/06_slides.pdf),
- [Source 2](https://www.jessesadler.com/post/network-analysis-with-r/),
- [Source 3](http://users.dimi.uniud.it/~massimo.franceschet/ns/syllabus/make/tidygraph/tidygraph.html),
- [Source 4](https://towardsdatascience.com/notes-on-graph-theory-centrality-measurements-e37d2e49550a), and
- [Source 5](https://networkingarchives.github.io/blog/2021/04/15/my-network-analysis-workflow/).
</textarea>
<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script src="assets/remark-zoom.js"></script>
<script src="https://platform.twitter.com/widgets.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"highlightLines": true,
"countIncrementalSlides": false,
"ratio": "16:9",
"navigation": {
"scroll": false
}
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {
window.dispatchEvent(new Event('resize'));
});
(function(d) {
var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler");
if (!r) return;
s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }";
d.head.appendChild(s);
})(document);
(function(d) {
var el = d.getElementsByClassName("remark-slides-area");
if (!el) return;
var slide, slides = slideshow.getSlides(), els = el[0].children;
for (var i = 1; i < slides.length; i++) {
slide = slides[i];
if (slide.properties.continued === "true" || slide.properties.count === "false") {
els[i - 1].className += ' has-continuation';
}
}
var s = d.createElement("style");
s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }";
d.head.appendChild(s);
})(document);
// delete the temporary CSS (for displaying all slides initially) when the user
// starts to view slides
(function() {
var deleted = false;
slideshow.on('beforeShowSlide', function(slide) {
if (deleted) return;
var sheets = document.styleSheets, node;
for (var i = 0; i < sheets.length; i++) {
node = sheets[i].ownerNode;
if (node.dataset["target"] !== "print-only") continue;
node.parentNode.removeChild(node);
}
deleted = true;
});
})();
(function() {
"use strict"
// Replace <script> tags in slides area to make them executable
var scripts = document.querySelectorAll(
'.remark-slides-area .remark-slide-container script'
);
if (!scripts.length) return;
for (var i = 0; i < scripts.length; i++) {
var s = document.createElement('script');
var code = document.createTextNode(scripts[i].textContent);
s.appendChild(code);
var scriptAttrs = scripts[i].attributes;
for (var j = 0; j < scriptAttrs.length; j++) {
s.setAttribute(scriptAttrs[j].name, scriptAttrs[j].value);
}
scripts[i].parentElement.replaceChild(s, scripts[i]);
}
})();
(function() {
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) {
links[i].target = '_blank';
}
}
})();
// adds .remark-code-has-line-highlighted class to <pre> parent elements
// of code chunks containing highlighted lines with class .remark-code-line-highlighted
(function(d) {
const hlines = d.querySelectorAll('.remark-code-line-highlighted');
const preParents = [];
const findPreParent = function(line, p = 0) {
if (p > 1) return null; // traverse up no further than grandparent
const el = line.parentElement;
return el.tagName === "PRE" ? el : findPreParent(el, ++p);
};
for (let line of hlines) {
let pre = findPreParent(line);
if (pre && !preParents.includes(pre)) preParents.push(pre);
}
preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted"));
})(document);</script>
<script>
slideshow._releaseMath = function(el) {
var i, text, code, codes = el.getElementsByTagName('code');
for (i = 0; i < codes.length;) {
code = codes[i];
if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) {
text = code.textContent;
if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) ||
/^\$\$(.|\s)+\$\$$/.test(text) ||
/^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) {
code.outerHTML = code.innerHTML; // remove <code></code>
continue;
}
}
i++;
}
};
slideshow._releaseMath(document);
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>