/
2013-04-12-Graphs.html
591 lines (469 loc) · 15.4 KB
/
2013-04-12-Graphs.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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>2013-04-12-Graphs</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="title" content="2013-04-12-Graphs"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2013-04-12 13:44:58 PDT"/>
<meta name="author" content="Jim Blomo"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" type="text/css" href="production/common.css" />
<link rel="stylesheet" type="text/css" href="production/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="production/projection.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/color-blue.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/presenter.css" media="presenter" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700|Yanone+Kaffeesatz:700|Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="preamble">
</div>
<div id="content">
<h1 class="title">2013-04-12-Graphs</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 Graphs & Networks</a>
<ul>
<li><a href="#sec-1-1">1.1 Midterm Stats</a></li>
</ul>
</li>
<li><a href="#sec-2">2 Graphs</a>
<ul>
<li><a href="#sec-2-1">2.1 Math</a></li>
</ul>
</li>
<li><a href="#sec-3">3 Vertices & Edges</a>
<ul>
<li><a href="#sec-3-1">3.1 Definitions</a></li>
</ul>
</li>
<li><a href="#sec-4">4 Examples</a>
<ul>
<li><a href="#sec-4-1">4.1 Examples</a></li>
</ul>
</li>
<li><a href="#sec-5">5 Social Networks</a>
<ul>
<li><a href="#sec-5-1">5.1 Symmetric</a></li>
</ul>
</li>
<li><a href="#sec-6">6 Definitions</a>
<ul>
<li><a href="#sec-6-1">6.1 Modeling</a></li>
</ul>
</li>
<li><a href="#sec-7">7 Acyclic?</a>
<ul>
<li><a href="#sec-7-1">7.1 Answers</a></li>
</ul>
</li>
<li><a href="#sec-8">8 Bipartite</a>
<ul>
<li><a href="#sec-8-1">8.1 Recommendations</a></li>
</ul>
</li>
<li><a href="#sec-9">9 Measurements</a>
<ul>
<li><a href="#sec-9-1">9.1 Data Stats</a></li>
<li><a href="#sec-9-2">9.2 Examples</a>
<ul>
<li><a href="#sec-9-2-1">9.2.1 Answers</a></li>
</ul></li>
</ul>
</li>
<li><a href="#sec-10">10 SimRank</a>
<ul>
<li><a href="#sec-10-1">10.1 Recursive</a></li>
<li><a href="#sec-10-2">10.2 Example</a>
<ul>
<li><a href="#sec-10-2-1">10.2.1 Calculations</a></li>
</ul></li>
</ul>
</li>
<li><a href="#sec-11">11 Random Walk</a></li>
<li><a href="#sec-12">12 <b>Break</b></a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Graphs & Networks <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-1-1" class="outline-3">
<h3 id="sec-1-1"><span class="section-number-3">1.1</span> Midterm Stats <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-1-1">
<ul>
<li>min 53.00
</li>
<li>max 87.00
</li>
<li>avg 75.53
</li>
<li>med 77.00
</li>
<li>stdev 9.28
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Graphs <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-2">
<ul>
<li>Can model a surprising number of domains
</li>
<li>Modeling with network opens up large number of algorithms
</li>
<li>Linear math has many connection to graphs
</li>
</ul>
</div>
<div id="outline-container-2-1" class="outline-3">
<h3 id="sec-2-1"><span class="section-number-3">2.1</span> Math <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-2-1">
<ul>
<li>Data mining theme: get your problem stated as a math problem, whole slew of
solutions present themselves
</li>
<li>Linear math really useful for running equations of all nodes, are simulate
moving across network
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Vertices & Edges <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-3">
<dl>
<dt>Vertex</dt><dd>the interconnected objects, or nodes
</dd>
<dt>Edge</dt><dd>the lines or curves that connect vertices
</dd>
<dt>Graph</dt><dd>Collection of vertices and edges <code>G = (V,E)</code>
</dd>
</dl>
<p> <img src="img/GraphNodesEdges.gif" alt="img/GraphNodesEdges.gif" />
</p>
</div>
<div id="outline-container-3-1" class="outline-3">
<h3 id="sec-3-1"><span class="section-number-3">3.1</span> Definitions <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-3-1">
<ul>
<li>These are the abstract terms, how do they relate to the real world?
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Examples <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-4">
<dl>
<dt>Vertex</dt><dd>User, building, router, product
</dd>
<dt>Edge</dt><dd>Relationship, road, network cable, purchased
</dd>
<dt>Graph</dt><dd>Social Network, physical infrastructure, internet, purchasing
history
</dd>
</dl>
</div>
<div id="outline-container-4-1" class="outline-3">
<h3 id="sec-4-1"><span class="section-number-3">4.1</span> Examples <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-4-1">
<ul>
<li>Many graphs have assumed edge labels: they edges represent something
consistent
</li>
<li>Some graphs have multiple times of edges: relationship is one of family,
friend, co-worker, etc.
</li>
<li>Edge can be anything that ties two things together: purchase history, eg.
is not a physical thing connecting, but an idea
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> Social Networks <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-5">
<ul>
<li>Edge connecting two people
</li>
<li>If this is just a line, what information are we missing about how the link
was formed?
</li>
</ul>
<p> <img src="img/jblomo-linkedin.gif" alt="img/jblomo-linkedin.gif" />
</p>
</div>
<div id="outline-container-5-1" class="outline-3">
<h3 id="sec-5-1"><span class="section-number-3">5.1</span> Symmetric <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-5-1">
<ul>
<li>"Just a line" is symmetric, ie "undirected"
</li>
<li>We're missing information about who invited whom. Asymmetric and <b>directed</b>
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> Definitions <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-6">
<dl>
<dt>Directed</dt><dd>Connections have a direction. Invitations, water pipes, email
</dd>
<dt>Undirected</dt><dd>Connections have no direction. "Friends," walkways on campus,
physical wires
</dd>
<dt>Cycle</dt><dd>Set of nodes and edges in which you can travel back to a vertex
</dd>
<dt>Acyclic</dt><dd>A graph without any cycles
</dd>
</dl>
<p> <img src="img/Directed_acyclic_graph.png" alt="img/Directed_acyclic_graph.png" />
</p>
</div>
<div id="outline-container-6-1" class="outline-3">
<h3 id="sec-6-1"><span class="section-number-3">6.1</span> Modeling <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-6-1">
<ul>
<li>Can always model undirected graph as a directed one by having two
connections between nodes always
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-7" class="outline-2">
<h2 id="sec-7"><span class="section-number-2">7</span> Acyclic? <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-7">
<ul>
<li>Social network (undirected)
</li>
<li>Product purchases (directed)
</li>
<li>Internet links (directed)
</li>
<li>Class prerequisites (directed)
</li>
</ul>
</div>
<div id="outline-container-7-1" class="outline-3">
<h3 id="sec-7-1"><span class="section-number-3">7.1</span> Answers <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-7-1">
<ul>
<li>Social network: cyclic
</li>
<li>Product purchases: acyclic
</li>
<li>Internet links: cyclic
</li>
<li>Class prerequisites: acyclic
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-8" class="outline-2">
<h2 id="sec-8"><span class="section-number-2">8</span> Bipartite <span class="tag"><span class="slide">slide</span> <span class="two_col">two_col</span></span></h2>
<div class="outline-text-2" id="text-8">
<ul>
<li>Graph whose vertices can be divided into two distinct sets
</li>
<li>Vertices in <code>U</code> are only connected to those in <code>V</code>, vice versa
</li>
<li>Product purchases: users <code>U</code>, products <code>V</code>
</li>
</ul>
<p> <img src="img/Simple-bipartite-graph.svg.png" alt="img/Simple-bipartite-graph.svg.png" />
</p>
</div>
<div id="outline-container-8-1" class="outline-3">
<h3 id="sec-8-1"><span class="section-number-3">8.1</span> Recommendations <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-8-1">
<ul>
<li>Can model recommendations as link following:
</li>
<li>From a user, follow to products
</li>
<li>From products, follow back to other users
</li>
<li>From other users, follow back to products
</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-9" class="outline-2">
<h2 id="sec-9"><span class="section-number-2">9</span> Measurements <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-9">
<dl>
<dt>Geodesic distance</dt><dd>Number of edges to connect to vertices
</dd>
<dt>Eccentricity</dt><dd>Largest geodesic distance from <code>v</code> to another
</dd>
<dt>Radius</dt><dd>Minimum eccentricity
</dd>
<dt>Diameter</dt><dd>Maximum eccentricity
</dd>
<dt>Peripheral vertex</dt><dd>Vertex with eccentricity == diameter
</dd>
<dt>Incoming/Outgoing edge count</dt><dd>Number of edges point to or from an edge
</dd>
</dl>
</div>
<div id="outline-container-9-1" class="outline-3">
<h3 id="sec-9-1"><span class="section-number-3">9.1</span> Data Stats <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-9-1">
<ul>
<li>Similar to getting distribution stats from initial datasets, these
measurements can help you understand graphs as a summary
</li>
<li>Once you have the incoming/outgoing edge counts, can use regular stats:
what is the distribution of counts?
</li>
</ul>
</div>
</div>
<div id="outline-container-9-2" class="outline-3">
<h3 id="sec-9-2"><span class="section-number-3">9.2</span> Examples <span class="tag"><span class="slide">slide</span> <span class="center">center</span></span></h3>
<div class="outline-text-3" id="text-9-2">
<p> <img src="img/6n-graf.svg.png" alt="img/6n-graf.svg.png" />
</p>
</div>
<div id="outline-container-9-2-1" class="outline-4">
<h4 id="sec-9-2-1"><span class="section-number-4">9.2.1</span> Answers <span class="tag"><span class="notes">notes</span></span></h4>
<div class="outline-text-4" id="text-9-2-1">
<ul>
<li>Distance 6, 5: 2
</li>
<li>Eccentricity 2: 3 (disconnected graph is infinity)
</li>
<li>Radius: 2
</li>
<li>Diameter: 3
</li>
<li>Pericheral Verticies: 1, 2, 6
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="outline-container-10" class="outline-2">
<h2 id="sec-10"><span class="section-number-2">10</span> SimRank <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-10">
<ul>
<li>Vertices are similar if they share similar neighbors
</li>
<li>SimRank between two vertices is the average of the SimRank of its neighbors
</li>
</ul>
<p> <img src="img/simrank.png" alt="img/simrank.png" />
<img src="img/simrank-iterative.png" alt="img/simrank-iterative.png" />
</p>
</div>
<div id="outline-container-10-1" class="outline-3">
<h3 id="sec-10-1"><span class="section-number-3">10.1</span> Recursive <span class="tag"><span class="notes">notes</span></span></h3>
<div class="outline-text-3" id="text-10-1">
<ul>
<li>This is an iterative and recursive definition
</li>
<li>Iterative because neighbors are influenced by each other
<ul>
<li>What is your simrank? Well, what is your simrank?
</li>
<li>Converges
</li>
</ul>
</li>
<li>Recursive because you're figuring out simrank for all neighbors
</li>
</ul>
</div>
</div>
<div id="outline-container-10-2" class="outline-3">
<h3 id="sec-10-2"><span class="section-number-3">10.2</span> Example <span class="tag"><span class="slide">slide</span></span></h3>
<div class="outline-text-3" id="text-10-2">
<p> <img src="img/6n-graf.svg.png" alt="img/6n-graf.svg.png" />
</p>
<p>
2 SimRank 4
</p>
</div>
<div id="outline-container-10-2-1" class="outline-4">
<h4 id="sec-10-2-1"><span class="section-number-4">10.2.1</span> Calculations <span class="tag"><span class="notes">notes</span></span></h4>
<div class="outline-text-4" id="text-10-2-1">
<ul>
<li>I(u) = 5,3,1
</li>
<li>I(v) = 5,3,6
</li>
<li>C = 0.6 daming factor.. similarity fades over time
</li>
<li>s0(5,5) = 1
</li>
<li>s0(3,3) = 1
</li>
<li>s0(5,3) = 0
</li>
<li>s0(3,5) = 0
</li>
<li>s0(1,5) = s0(1,3) = 0, s0(6,1)… = 0
</li>
<li>s1= 0.6/(2*2) * sum(1,1,0,0,0,0)
</li>
<li>0.3
</li>
<li>Next round, we'll need to figure out s1 of 5,3 to calculate update
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="outline-container-11" class="outline-2">
<h2 id="sec-11"><span class="section-number-2">11</span> Random Walk <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-11">
<ul>
<li>Many algorithms based on concept of randomly deciding:
<ul>
<li>Follow link or not
</li>
<li>Which link to follow
</li>
</ul>
</li>
<li>Simulate the decision many times
</li>
<li>What is the probability you will wind up on <code>u</code> from <code>v</code>?
</li>
</ul>
</div>
</div>
<div id="outline-container-12" class="outline-2">
<h2 id="sec-12"><span class="section-number-2">12</span> <b>Break</b> <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-12">
<script type="text/javascript" src="production/org-html-slideshow.js"></script>
</div>
</div>
</div>
<div id="postamble">
<p class="date">Date: 2013-04-12 13:44:58 PDT</p>
<p class="author">Author: Jim Blomo</p>
<p class="creator">Org version 7.8.02 with Emacs version 23</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</body>
</html>