|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="" xml:lang=""> |
| 3 | + <head> |
| 4 | + <title>MAT381E-Week 10: Creating and Visualizing Networks</title> |
| 5 | + <meta charset="utf-8" /> |
| 6 | + <meta name="author" content="Gül İnan" /> |
| 7 | + <meta name="date" content="2022-01-10" /> |
| 8 | + <script src="intro_networks_files/header-attrs-2.11/header-attrs.js"></script> |
| 9 | + <link href="intro_networks_files/remark-css-0.0.1/default.css" rel="stylesheet" /> |
| 10 | + <script src="intro_networks_files/fabric-4.3.1/fabric.min.js"></script> |
| 11 | + <link href="intro_networks_files/xaringanExtra-scribble-0.0.1/scribble.css" rel="stylesheet" /> |
| 12 | + <script src="intro_networks_files/xaringanExtra-scribble-0.0.1/scribble.js"></script> |
| 13 | + <script>document.addEventListener('DOMContentLoaded', function() { window.xeScribble = new Scribble({"pen_color":["#FF0000"],"pen_size":3,"eraser_size":30,"palette":[]}) })</script> |
| 14 | + <link href="intro_networks_files/tile-view-0.2.6/tile-view.css" rel="stylesheet" /> |
| 15 | + <script src="intro_networks_files/tile-view-0.2.6/tile-view.js"></script> |
| 16 | + <link href="intro_networks_files/animate.css-3.7.2/animate.xaringan.css" rel="stylesheet" /> |
| 17 | + <link href="intro_networks_files/tachyons-4.12.0/tachyons.min.css" rel="stylesheet" /> |
| 18 | + <link href="intro_networks_files/panelset-0.2.6/panelset.css" rel="stylesheet" /> |
| 19 | + <script src="intro_networks_files/panelset-0.2.6/panelset.js"></script> |
| 20 | + <link rel="stylesheet" href="xaringan-themer.css" type="text/css" /> |
| 21 | + <link rel="stylesheet" href="assets/sydney-fonts.css" type="text/css" /> |
| 22 | + <link rel="stylesheet" href="assets/sydney.css" type="text/css" /> |
| 23 | + </head> |
| 24 | + <body> |
| 25 | + <textarea id="source"> |
| 26 | +class: left, middle, my-title, title-slide |
| 27 | + |
| 28 | +# MAT381E-Week 10: Creating and Visualizing Networks |
| 29 | +### Gül İnan |
| 30 | +### Department of Mathematics<br/>Istanbul Technical University |
| 31 | +### January 10, 2022 |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +class: left |
| 48 | + |
| 49 | +# Outline |
| 50 | + |
| 51 | +* What is Network? |
| 52 | + * Examples |
| 53 | +* Elements of a graph. |
| 54 | +* The `tidygraph` and `ggraph` packages. |
| 55 | +--- |
| 56 | + |
| 57 | +class: center, middle |
| 58 | + |
| 59 | +Internet - the largest engineering project |
| 60 | + |
| 61 | +<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> |
| 62 | + |
| 63 | +[Source](https://www.opte.org/) |
| 64 | + |
| 65 | +--- |
| 66 | +class: middle, center |
| 67 | + |
| 68 | +<img src="images/internet.png" width="100%" height="100%" /> |
| 69 | + |
| 70 | +[Source](https://www.opte.org/about) |
| 71 | +--- |
| 72 | + |
| 73 | +# Networks |
| 74 | +- **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**. |
| 75 | +- With an example from Facebook network, we can consider **vertices** are **users** in the network and **edges** are links denoting **friendships**. |
| 76 | + |
| 77 | + |
| 78 | +<img src="images/fb.jpeg" width="40%" height="40%" style="display: block; margin: auto;" /> |
| 79 | +--- |
| 80 | +#### Networks are everywhere!.. |
| 81 | + |
| 82 | +- In real life, network analysis helps us to understand complex relationships, |
| 83 | +learn about behaviors, preferences, and trends. |
| 84 | + |
| 85 | +--- |
| 86 | +#### Example: History |
| 87 | +<style type="text/css"> |
| 88 | +.pull-left { |
| 89 | + float: left; |
| 90 | + width: 50%; |
| 91 | +} |
| 92 | +.pull-right { |
| 93 | + float: right; |
| 94 | + width: 50%; |
| 95 | +} |
| 96 | +</style> |
| 97 | + |
| 98 | +.pull-left[ |
| 99 | +<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> |
| 100 | +] |
| 101 | + |
| 102 | +.pull-right[ |
| 103 | +<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> |
| 104 | +] |
| 105 | +--- |
| 106 | +#### Example: Job Connectivity in US |
| 107 | + |
| 108 | +<img src="images/example.png" width="75%" height="100%" /> |
| 109 | + |
| 110 | +[Source](https://news.mit.edu/2021/job-connectivity-improves-resiliency-us-cities-0413) |
| 111 | + |
| 112 | +--- |
| 113 | +#### Example continu'ed |
| 114 | +- "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." |
| 115 | +- "Traditional modeling approaches in this realm have treated **workers as narrowly linked to specific jobs**. |
| 116 | +- "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>" |
| 117 | +- "In this way, **job markets are much like ecosystems, where organisms are linked in a complex web of relationships**. |
| 118 | +- "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." |
| 119 | +- "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." |
| 120 | +- "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." |
| 121 | +- 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. |
| 122 | +- "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." |
| 123 | +- "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." |
| 124 | + |
| 125 | +--- |
| 126 | +<style type="text/css"> |
| 127 | +.pull-left { |
| 128 | + float: left; |
| 129 | + width: 50%; |
| 130 | +} |
| 131 | +.pull-right { |
| 132 | + float: right; |
| 133 | + width: 50%; |
| 134 | +} |
| 135 | +</style> |
| 136 | + |
| 137 | +#### Example: Open Syllabus Co-assignment Galaxy |
| 138 | +- 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. |
| 139 | + |
| 140 | +.pull-left[ |
| 141 | +<img src="images/open_syllabus.png" width="100%" height="100%" /> |
| 142 | +] |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | +.pull-right[ |
| 147 | +<img src="images/syl.png" width="100%" height="100%" /> |
| 148 | +] |
| 149 | + |
| 150 | +[Source 1](https://galaxy.opensyllabus.org/#!viewport/5.5826/21.4688/-7.8283/0.0187) |
| 151 | +[Source 2](https://blog.opensyllabus.org/galaxy-v2) |
| 152 | + |
| 153 | +--- |
| 154 | +#### Example: Covid-19 Knowledge Graph |
| 155 | + |
| 156 | +<img src="images/covidgraph.png" width="80%" height="100%" /> |
| 157 | + |
| 158 | +[Source](https://covidgraph.org/) |
| 159 | + |
| 160 | +--- |
| 161 | +<style type="text/css"> |
| 162 | +.pull-left { |
| 163 | + float: left; |
| 164 | + width: 50%; |
| 165 | +} |
| 166 | +.pull-right { |
| 167 | + float: right; |
| 168 | + width: 50%; |
| 169 | +} |
| 170 | +</style> |
| 171 | + |
| 172 | +#### Example: Covid-19 Bibliometric Analysis |
| 173 | + |
| 174 | +.pull-left[ |
| 175 | +<img src="images/bib1.png" width="100%" height="100%" /> |
| 176 | +] |
| 177 | + |
| 178 | + |
| 179 | +.pull-right[ |
| 180 | +<img src="images/bib2.png" width="100%" height="100%" /> |
| 181 | +] |
| 182 | + |
| 183 | +[Source](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7396244/) |
| 184 | + |
| 185 | +--- |
| 186 | +#### More at: Stanford Large Network Dataset Collection |
| 187 | + |
| 188 | +<img src="images/stanford.png" width="100%" height="100%" /> |
| 189 | +[Source](https://snap.stanford.edu/data/index.html) |
| 190 | + |
| 191 | +--- |
| 192 | +#### Popular Network Analysis Software |
| 193 | +- Network analysis and visualization tools are mostly implemented either in a **specific software with a GUI** such as: |
| 194 | + - [Gephi](https://gephi.org/) and |
| 195 | + - [Cytoscape](https://cytoscape.org/) |
| 196 | +- or in a **package/library within a programming language** such as: |
| 197 | + - [igraph](https://igraph.org/) (R/Python library), |
| 198 | + - [tidygraph](https://cran.r-project.org/web/packages/tidygraph/index.html) (R library), |
| 199 | + - [ggraph](https://cran.r-project.org/web/packages/ggraph/index.html) (R library), and |
| 200 | + - [NetworkX](https://networkx.org/) (Python library). |
| 201 | +--- |
| 202 | +#### Graph Data Bases |
| 203 | +- 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. |
| 204 | + |
| 205 | +<img src="images/nasa.png" width="100%" height="100%" /> |
| 206 | +--- |
| 207 | +- Some free books to download from web: |
| 208 | + |
| 209 | +.pull-left[ |
| 210 | +<img src="images/graphds.png" width="80%" height="100%" /> |
| 211 | +[Source](https://neo4j.com/graph-data-science-for-dummies/?ref=home) |
| 212 | +] |
| 213 | + |
| 214 | +.pull-right[ |
| 215 | +<img src="images/graph_apache.png" width="80%" height="100%" /> |
| 216 | +[Source](https://neo4j.com/graph-data-science-for-dummies/?ref=home) |
| 217 | +] |
| 218 | + |
| 219 | +--- |
| 220 | +- Research Institutes |
| 221 | + |
| 222 | +<a href="https://www.networkscienceinstitute.org/" target="_blank"><img src="images/northeastern.png" width="80%" height="100%" style="display: block; margin: auto;" /></a> |
| 223 | + |
| 224 | +--- |
| 225 | +- More is available at: |
| 226 | + - [Handbook of Graphs and Networks in People Analytics](https://ona-book.org/gitbook/). |
| 227 | + - [Awesome list curated by François Briatte](https://github.com/briatte/awesome-network-analysis). |
| 228 | + - [Katya Ognyanova's Network Visualization with R](http://kateto.net/network-visualization). |
| 229 | + - [Douglas A. Luke, *A User’s Guide to Network Analysis in R* (2015)](http://www.springer.com/us/book/9783319238821). |
| 230 | + - [Eric D. Kolaczyk and Gábor Csárdi's, Statistical Analysis of Network Data with R (2014)](http://www.springer.com/us/book/9781493909827). |
| 231 | + |
| 232 | +--- |
| 233 | +# Attributions |
| 234 | +- All images used in this slide are taken from the web. |
| 235 | +- This lecture note is mainly developed by following sources: |
| 236 | + - [Source 1](http://veronikarock.com/teaching/06_slides.pdf), |
| 237 | + - [Source 2](https://www.jessesadler.com/post/network-analysis-with-r/), |
| 238 | + - [Source 3](http://users.dimi.uniud.it/~massimo.franceschet/ns/syllabus/make/tidygraph/tidygraph.html), |
| 239 | + - [Source 4](https://towardsdatascience.com/notes-on-graph-theory-centrality-measurements-e37d2e49550a), and |
| 240 | + - [Source 5](https://networkingarchives.github.io/blog/2021/04/15/my-network-analysis-workflow/). |
| 241 | + |
| 242 | + |
| 243 | + </textarea> |
| 244 | +<style data-target="print-only">@media screen {.remark-slide-container{display:block;}.remark-slide-scaler{box-shadow:none;}}</style> |
| 245 | +<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script> |
| 246 | +<script src="assets/remark-zoom.js"></script> |
| 247 | +<script src="https://platform.twitter.com/widgets.js"></script> |
| 248 | +<script>var slideshow = remark.create({ |
| 249 | +"highlightStyle": "github", |
| 250 | +"highlightLines": true, |
| 251 | +"countIncrementalSlides": false, |
| 252 | +"ratio": "16:9", |
| 253 | +"navigation": { |
| 254 | +"scroll": false |
| 255 | +} |
| 256 | +}); |
| 257 | +if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) { |
| 258 | + window.dispatchEvent(new Event('resize')); |
| 259 | +}); |
| 260 | +(function(d) { |
| 261 | + var s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler"); |
| 262 | + if (!r) return; |
| 263 | + s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }"; |
| 264 | + d.head.appendChild(s); |
| 265 | +})(document); |
| 266 | + |
| 267 | +(function(d) { |
| 268 | + var el = d.getElementsByClassName("remark-slides-area"); |
| 269 | + if (!el) return; |
| 270 | + var slide, slides = slideshow.getSlides(), els = el[0].children; |
| 271 | + for (var i = 1; i < slides.length; i++) { |
| 272 | + slide = slides[i]; |
| 273 | + if (slide.properties.continued === "true" || slide.properties.count === "false") { |
| 274 | + els[i - 1].className += ' has-continuation'; |
| 275 | + } |
| 276 | + } |
| 277 | + var s = d.createElement("style"); |
| 278 | + s.type = "text/css"; s.innerHTML = "@media print { .has-continuation { display: none; } }"; |
| 279 | + d.head.appendChild(s); |
| 280 | +})(document); |
| 281 | +// delete the temporary CSS (for displaying all slides initially) when the user |
| 282 | +// starts to view slides |
| 283 | +(function() { |
| 284 | + var deleted = false; |
| 285 | + slideshow.on('beforeShowSlide', function(slide) { |
| 286 | + if (deleted) return; |
| 287 | + var sheets = document.styleSheets, node; |
| 288 | + for (var i = 0; i < sheets.length; i++) { |
| 289 | + node = sheets[i].ownerNode; |
| 290 | + if (node.dataset["target"] !== "print-only") continue; |
| 291 | + node.parentNode.removeChild(node); |
| 292 | + } |
| 293 | + deleted = true; |
| 294 | + }); |
| 295 | +})(); |
| 296 | +(function() { |
| 297 | + "use strict" |
| 298 | + // Replace <script> tags in slides area to make them executable |
| 299 | + var scripts = document.querySelectorAll( |
| 300 | + '.remark-slides-area .remark-slide-container script' |
| 301 | + ); |
| 302 | + if (!scripts.length) return; |
| 303 | + for (var i = 0; i < scripts.length; i++) { |
| 304 | + var s = document.createElement('script'); |
| 305 | + var code = document.createTextNode(scripts[i].textContent); |
| 306 | + s.appendChild(code); |
| 307 | + var scriptAttrs = scripts[i].attributes; |
| 308 | + for (var j = 0; j < scriptAttrs.length; j++) { |
| 309 | + s.setAttribute(scriptAttrs[j].name, scriptAttrs[j].value); |
| 310 | + } |
| 311 | + scripts[i].parentElement.replaceChild(s, scripts[i]); |
| 312 | + } |
| 313 | +})(); |
| 314 | +(function() { |
| 315 | + var links = document.getElementsByTagName('a'); |
| 316 | + for (var i = 0; i < links.length; i++) { |
| 317 | + if (/^(https?:)?\/\//.test(links[i].getAttribute('href'))) { |
| 318 | + links[i].target = '_blank'; |
| 319 | + } |
| 320 | + } |
| 321 | +})(); |
| 322 | +// adds .remark-code-has-line-highlighted class to <pre> parent elements |
| 323 | +// of code chunks containing highlighted lines with class .remark-code-line-highlighted |
| 324 | +(function(d) { |
| 325 | + const hlines = d.querySelectorAll('.remark-code-line-highlighted'); |
| 326 | + const preParents = []; |
| 327 | + const findPreParent = function(line, p = 0) { |
| 328 | + if (p > 1) return null; // traverse up no further than grandparent |
| 329 | + const el = line.parentElement; |
| 330 | + return el.tagName === "PRE" ? el : findPreParent(el, ++p); |
| 331 | + }; |
| 332 | + |
| 333 | + for (let line of hlines) { |
| 334 | + let pre = findPreParent(line); |
| 335 | + if (pre && !preParents.includes(pre)) preParents.push(pre); |
| 336 | + } |
| 337 | + preParents.forEach(p => p.classList.add("remark-code-has-line-highlighted")); |
| 338 | +})(document);</script> |
| 339 | + |
| 340 | +<script> |
| 341 | +slideshow._releaseMath = function(el) { |
| 342 | + var i, text, code, codes = el.getElementsByTagName('code'); |
| 343 | + for (i = 0; i < codes.length;) { |
| 344 | + code = codes[i]; |
| 345 | + if (code.parentNode.tagName !== 'PRE' && code.childElementCount === 0) { |
| 346 | + text = code.textContent; |
| 347 | + if (/^\\\((.|\s)+\\\)$/.test(text) || /^\\\[(.|\s)+\\\]$/.test(text) || |
| 348 | + /^\$\$(.|\s)+\$\$$/.test(text) || |
| 349 | + /^\\begin\{([^}]+)\}(.|\s)+\\end\{[^}]+\}$/.test(text)) { |
| 350 | + code.outerHTML = code.innerHTML; // remove <code></code> |
| 351 | + continue; |
| 352 | + } |
| 353 | + } |
| 354 | + i++; |
| 355 | + } |
| 356 | +}; |
| 357 | +slideshow._releaseMath(document); |
| 358 | +</script> |
| 359 | +<!-- dynamically load mathjax for compatibility with self-contained --> |
| 360 | +<script> |
| 361 | +(function () { |
| 362 | + var script = document.createElement('script'); |
| 363 | + script.type = 'text/javascript'; |
| 364 | + script.src = 'https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML'; |
| 365 | + if (location.protocol !== 'file:' && /^https?:/.test(script.src)) |
| 366 | + script.src = script.src.replace(/^https?:/, ''); |
| 367 | + document.getElementsByTagName('head')[0].appendChild(script); |
| 368 | +})(); |
| 369 | +</script> |
| 370 | + </body> |
| 371 | +</html> |
0 commit comments