Distributed Computing Seminar Lecture 5: Graph Algorithms & PageRank Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet Summer 2007 Except.

Slides:



Advertisements
Similar presentations
Overview of this week Debugging tips for ML algorithms
Advertisements

CSE 5243 (AU 14) Graph Basics and a Gentle Introduction to PageRank 1.
1 The PageRank Citation Ranking: Bring Order to the web Lawrence Page, Sergey Brin, Rajeev Motwani and Terry Winograd Presented by Fei Li.
The math behind PageRank A detailed analysis of the mathematical aspects of PageRank Computational Mathematics class presentation Ravi S Sinha LIT lab,
1 Theory I Algorithm Design and Analysis (10 - Shortest paths in graphs) T. Lauer.
Data-Intensive Computing with MapReduce Jimmy Lin University of Maryland Thursday, February 21, 2013 Session 5: Graph Processing This work is licensed.
大规模数据处理 / 云计算 Lecture 6 – Graph Algorithm 彭波 北京大学信息科学技术学院 4/26/2011 This work is licensed under a Creative Commons.
Thanks to Jimmy Lin slides
DATA MINING LECTURE 12 Link Analysis Ranking Random walks.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
Introduction to PageRank Algorithm and Programming Assignment 1 CSC4170 Web Intelligence and Social Computing Tutorial 4 Tutor: Tom Chao Zhou
Tirgul 12 Algorithm for Single-Source-Shortest-Paths (s-s-s-p) Problem Application of s-s-s-p for Solving a System of Difference Constraints.
Graph & BFS.
Hadoop Technical Workshop Module III: MapReduce Algorithms.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
Multimedia Databases SVD II. Optimality of SVD Def: The Frobenius norm of a n x m matrix M is (reminder) The rank of a matrix M is the number of independent.
Cloud Computing Lecture #5 Graph Algorithms with MapReduce Jimmy Lin The iSchool University of Maryland Wednesday, October 1, 2008 This work is licensed.
Graph COMP171 Fall Graph / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D E A C F B Vertex Edge.
Graph & BFS Lecture 22 COMP171 Fall Graph & BFS / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D.
MapReduce Algorithms CSE 490H. Algorithms for MapReduce Sorting Searching TF-IDF BFS PageRank More advanced algorithms.
Graphs & Graph Algorithms 2 Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland Tuesday, June 29, 2010 This work is licensed.
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
1 COMP4332 Web Data Thanks for Raymond Wong’s slides.
Cloud Computing Lecture #4 Graph Algorithms with MapReduce Jimmy Lin The iSchool University of Maryland Wednesday, February 6, 2008 This work is licensed.
Google and the Page Rank Algorithm Székely Endre
CS246 Link-Based Ranking. Problems of TFIDF Vector  Works well on small controlled corpus, but not on the Web  Top result for “American Airlines” query:
Graph Essentials Social Media Mining. 2 Measures and Metrics 2 Social Media Mining Graph Essentials Networks A network is a graph. – Elements of the network.
Social Media Mining Graph Essentials.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland MLG, January, 2014 Jaehwan Lee.
The PageRank Citation Ranking: Bringing Order to the Web Presented by Aishwarya Rengamannan Instructor: Dr. Gautam Das.
Graph Algorithms Ch. 5 Lin and Dyer. Graphs Are everywhere Manifest in the flow of s Connections on social network Bus or flight routes Social graphs:
Introduction to MapReduce Amit K Singh. “The density of transistors on a chip doubles every 18 months, for the same cost” (1965) Do you recognize this.
CSCI-455/552 Introduction to High Performance Computing Lecture 18.
1 Graphs Algorithms Sections 9.1, 9.2, and Graphs v1v1 v2v2 v5v5 v7v7 v8v8 v3v3 v6v6 v4v4 A graph G = (V, E) –V: set of vertices (nodes) –E: set.
WAN technologies and routing Packet switches and store and forward Hierarchical addresses, routing and routing tables Routing table computation Example.
MapReduce and Graph Data Chapter 5 Based on slides from Jimmy Lin’s lecture slides ( (licensed.
MapReduce Theory, Implementation and Algorithms Hongfei Yan School of EECS, Peking University 7/1/2008 Refer to Aaron.
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz (Slides by Tyler S. Randolph)
The PageRank Citation Ranking: Bringing Order to the Web Lawrence Page, Sergey Brin, Rajeev Motwani, Terry Winograd Presented by Anca Leuca, Antonis Makropoulos.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Graphs.
1 MapReduce: Theory and Implementation CSE 490h – Intro to Distributed Computing, Modified by George Lee Except as otherwise noted, the content of this.
Keyword Search in Databases using PageRank By Michael Sirivianos April 11, 2003.
© Spinnaker Labs, Inc. Google Cluster Computing Faculty Training Workshop Module IV: MapReduce Theory, Implementation, and Algorithms This presentation.
Graphs. Definitions A graph is two sets. A graph is two sets. –A set of nodes or vertices V –A set of edges E Edges connect nodes. Edges connect nodes.
Graph Algorithms. Graph Algorithms: Topics  Introduction to graph algorithms and graph represent ations  Single Source Shortest Path (SSSP) problem.
Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media.
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Big Data Infrastructure Week 5: Analyzing Graphs (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United.
Big Data Infrastructure Week 5: Analyzing Graphs (1/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United.
Ljiljana Rajačić. Page Rank Web as a directed graph  Nodes: Web pages  Edges: Hyperlinks 2 / 25 Ljiljana Rajačić.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Importance Measures on Nodes Lecture 2 Srinivasan Parthasarathy 1.
Main Index Contents 11 Main Index Contents Graph Categories Graph Categories Example of Digraph Example of Digraph Connectedness of Digraph Connectedness.
Random Sampling Algorithms with Applications Kyomin Jung KAIST Aug ERC Workshop.
大规模数据处理 / 云计算 05 – Graph Algorithm 闫宏飞 北京大学信息科学技术学院 7/22/2014 Jimmy Lin University of Maryland SEWMGroup This work.
CLOUD COMPUTING ARCHITECTURES & APPLICATIONS LECTURERS LAZAR KIRCHEV, PhD ILIYAN NENOV KRUM BAKALSKY 14 March, 2011 LECTURE #2 PARALLEL DATA PROCESSING.
Big Data Infrastructure
Big Data Infrastructure
Google Cluster Computing Faculty Training Workshop
Link-Based Ranking Seminar Social Media Mining University UC3M
DTMC Applications Ranking Web Pages & Slotted ALOHA
MapReduce and Data Management
Cloud Computing Lecture #4 Graph Algorithms with MapReduce
A* Path Finding Ref: A-star tutorial.
Advanced Computer Networks
Graph Algorithms Adapted from UMD Jimmy Lin’s slides, which is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.
Presentation transcript:

Distributed Computing Seminar Lecture 5: Graph Algorithms & PageRank Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet Summer 2007 Except as otherwise noted, the content of this presentation is © 2007 Google Inc. and licensed under the Creative Commons Attribution 2.5 License.

Outline Motivation Graph Representations Breadth-First Search & Shortest-Path Finding PageRank

Motivating Concepts Performing computation on a graph data structure requires processing at each node Each node contains node-specific data as well as links (edges) to other nodes Computation must traverse the graph and perform the computation step How do we traverse a graph in MapReduce? How do we represent the graph for this?

Breadth-First Search Breadth-First Search is an iterated algorithm over graphs Frontier advances from origin by one level with each pass

Breadth-First Search & MapReduce Problem: This doesn't “fit” into MapReduce Solution: Iterated passes through MapReduce – map some nodes, result includes additional nodes which are fed into successive MapReduce passes

Breadth-First Search & MapReduce Problem: Sending the entire graph to a map task (or hundreds/thousands of map tasks) involves an enormous amount of memory Solution: Carefully consider how we represent graphs

Graph Representations The most straightforward representation of graphs uses references from each node to its neighbors

Direct References Structure is inherent to object Iteration requires linked list “threaded through” graph Requires common view of shared memory (synchronization!) Not easily serializable class GraphNode { Object data; Vector out_edges; GraphNode iter_next; }

Adjacency Matrices Another classic graph representation. M[i][j]= '1' implies a link from node i to j. Naturally encapsulates iteration over nodes

Adjacency Matrices: Sparse Representation Adjacency matrix for most large graphs (e.g., the web) will be overwhelmingly full of zeros. Each row of the graph is absurdly long Sparse matrices only include non-zero elements

Sparse Matrix Representation 1: (3, 1), (18, 1), (200, 1) 2: (6, 1), (12, 1), (80, 1), (400, 1) 3: (1, 1), (14, 1) …

Sparse Matrix Representation 1: 3, 18, 200 2: 6, 12, 80, 400 3: 1, 14 …

Finding the Shortest Path A common graph search application is finding the shortest path from a start node to one or more target nodes Commonly done on a single machine with Dijkstra's Algorithm Can we use BFS to find the shortest path via MapReduce? This is called the single-source shortest path problem. (a.k.a. SSSP)

Finding the Shortest Path: Intuition We can define the solution to this problem inductively:  DistanceTo(startNode) = 0  For all nodes n directly reachable from startNode, DistanceTo(n) = 1  For all nodes n reachable from some other set of nodes S, DistanceTo(n) = 1 + min(DistanceTo(m), m  S)

From Intuition to Algorithm A map task receives a node n as a key, and (D, points-to) as its value  D is the distance to the node from the start  points-to is a list of nodes reachable from n  p  points-to, emit (p, D+1) Reduce task gathers possible distances to a given p and selects the minimum one

What This Gives Us This MapReduce task can advance the known frontier by one hop To perform the whole BFS, a non- MapReduce component then feeds the output of this step back into the MapReduce task for another iteration  Problem: Where'd the points-to list go?  Solution: Mapper emits (n, points-to) as well

Blow-up and Termination This algorithm starts from one node Subsequent iterations include many more nodes of the graph as frontier advances Does this ever terminate?  Yes! Eventually, routes between nodes will stop being discovered and no better distances will be found. When distance is the same, we stop  Mapper should emit (n, D) to ensure that “current distance” is carried into the reducer

Adding weights Weighted-edge shortest path is more useful than cost==1 approach Simple change: points-to list in map task includes a weight 'w' for each pointed-to node  emit (p, D+w p ) instead of (p, D+1) for each node p  Works for positive-weighted graph

Comparison to Dijkstra Dijkstra's algorithm is more efficient because at any step it only pursues edges from the minimum-cost path inside the frontier MapReduce version explores all paths in parallel; not as efficient overall, but the architecture is more scalable Equivalent to Dijkstra for weight=1 case

PageRank: Random Walks Over The Web If a user starts at a random web page and surfs by clicking links and randomly entering new URLs, what is the probability that s/he will arrive at a given page? The PageRank of a page captures this notion  More “popular” or “worthwhile” pages get a higher rank

PageRank: Visually

PageRank: Formula Given page A, and pages T 1 through T n linking to A, PageRank is defined as: PR(A) = (1-d) + d (PR(T 1 )/C(T 1 ) PR(T n )/C(T n )) C(P) is the cardinality (out-degree) of page P d is the damping (“random URL”) factor

PageRank: Intuition Calculation is iterative: PR i+1 is based on PR i Each page distributes its PR i to all pages it links to. Linkees add up their awarded rank fragments to find their PR i+1 d is a tunable parameter (usually = 0.85) encapsulating the “random jump factor” PR(A) = (1-d) + d (PR(T 1 )/C(T 1 ) PR(T n )/C(T n ))

PageRank: Issues Is PageRank guaranteed to converge? How quickly? What is the “correct” value of d, and how sensitive is the algorithm to it? What is an efficient algorithm to solve this?

PageRank: First Implementation Create two tables 'current' and 'next' holding the PageRank for each page. Seed 'current' with initial PR values Iterate over all pages in the graph, distributing PR from 'current' into 'next' of linkees current := next; next := fresh_table(); Go back to iteration step or end if converged

Distribution of the Algorithm Key insights allowing parallelization:  The 'next' table depends on 'current', but not on any other rows of 'next'  Individual rows of the adjacency matrix can be processed in parallel  Sparse matrix rows are relatively small

Distribution of the Algorithm Consequences of insights:  We can map each row of 'current' to a list of PageRank “fragments” to assign to linkees  These fragments can be reduced into a single PageRank value for a page by summing  Graph representation can be even more compact; since each element is simply 0 or 1, only transmit column numbers where it's 1

Phase 1: Parse HTML Map task takes (URL, page content) pairs and maps them to (URL, (PR init, list-of-urls))  PR init is the “seed” PageRank for URL  list-of-urls contains all pages pointed to by URL Reduce task is just the identity function

Phase 2: PageRank Distribution Map task takes (URL, (cur_rank, url_list))  For each u in url_list, emit (u, cur_rank/|url_list|)  Emit (URL, url_list) to carry the points-to list along through iterations PR(A) = (1-d) + d (PR(T 1 )/C(T 1 ) PR(T n )/C(T n ))

Phase 2: PageRank Distribution Reduce task gets (URL, url_list) and many (URL, val) values  Sum vals and fix up with d  Emit (URL, (new_rank, url_list)) PR(A) = (1-d) + d (PR(T 1 )/C(T 1 ) PR(T n )/C(T n ))

Finishing up... A non-parallelizable component determines whether convergence has been achieved (Fixed number of iterations? Comparison of key values?) If so, write out the PageRank lists - done! Otherwise, feed output of Phase 2 into another Phase 2 iteration

Conclusions MapReduce isn't the greatest at iterated computation, but still helps run the “heavy lifting” Key element in parallelization is independent PageRank computations in a given step Parallelization requires thinking about minimum data partitions to transmit (e.g., compact representations of graph rows)  Even the implementation shown today doesn't actually scale to the whole Internet; but it works for intermediate-sized graphs