MapReduce and Graph Data Chapter 5 Based on slides from Jimmy Lin’s lecture slides (http://www.umiacs.umd.edu/~jimmylin/cloud-2010-Spring/index.html) (licensed.

Slides:



Advertisements
Similar presentations
Map-Reduce Graph Processing Adapted from UMD Jimmy Lin’s slides, which is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United.
Advertisements

Overview of this week Debugging tips for ML algorithms
1 Machine Learning: Lecture 4 Artificial Neural Networks (Based on Chapter 4 of Mitchell T.., Machine Learning, 1997)
CSE 5243 (AU 14) Graph Basics and a Gentle Introduction to PageRank 1.
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
Graph A graph, G = (V, E), is a data structure where: V is a set of vertices (aka nodes) E is a set of edges We use graphs to represent relationships among.
CS345 Data Mining Link Analysis Algorithms Page Rank Anand Rajaraman, Jeffrey D. Ullman.
Link Analysis: PageRank
More on Rankings. Query-independent LAR Have an a-priori ordering of the web pages Q: Set of pages that contain the keywords in the query q Present the.
DATA MINING LECTURE 12 Link Analysis Ranking Random walks.
Cloud Computing Lecture #3 More MapReduce Jimmy Lin The iSchool University of Maryland Wednesday, September 10, 2008 This work is licensed under a Creative.
Introduction to PageRank Algorithm and Programming Assignment 1 CSC4170 Web Intelligence and Social Computing Tutorial 4 Tutor: Tom Chao Zhou
Graph & BFS.
Introduction to Information Retrieval Introduction to Information Retrieval Hinrich Schütze and Christina Lioma Lecture 21: Link Analysis.
Jimmy Lin The iSchool University of Maryland Wednesday, April 15, 2009
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.
Zdravko Markov and Daniel T. Larose, Data Mining the Web: Uncovering Patterns in Web Content, Structure, and Usage, Wiley, Slides for Chapter 1:
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.
COMP171 Depth-First Search.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland Tuesday, June 29, 2010 This work is licensed.
CS345 Data Mining Link Analysis Algorithms Page Rank Anand Rajaraman, Jeffrey D. Ullman.
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.
MapReduce and Data Management Based on slides from Jimmy Lin’s lecture slides ( (licensed.
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:
Leveraging Big Data: Lecture 11 Instructors: Edith Cohen Amos Fiat Haim Kaplan Tova Milo.
Social Media Mining Graph Essentials.
Λ14 Διαδικτυακά Κοινωνικά Δίκτυα και Μέσα
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:
Piyush Kumar (Lecture 2: PageRank) Welcome to COT5405.
Web Search. Structure of the Web n The Web is a complex network (graph) of nodes & links that has the appearance of a self-organizing structure  The.
Social Networking Algorithms related sections to read in Networked Life: 2.1,
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz (Slides by Tyler S. Randolph)
COM1721: Freshman Honors Seminar A Random Walk Through Computing Lecture 2: Structure of the Web October 1, 2002.
DATA MINING LECTURE 13 Pagerank, Absorbing Random Walks Coverage Problems.
The PageRank Citation Ranking: Bringing Order to the Web Lawrence Page, Sergey Brin, Rajeev Motwani, Terry Winograd Presented by Anca Leuca, Antonis Makropoulos.
PageRank. s1s1 p 12 p 21 s2s2 s3s3 p 31 s4s4 p 41 p 34 p 42 p 13 x 1 = p 21 p 34 p 41 + p 34 p 42 p 21 + p 21 p 31 p 41 + p 31 p 42 p 21 / Σ x 2 = p 31.
Graph Algorithms. Graph Algorithms: Topics  Introduction to graph algorithms and graph represent ations  Single Source Shortest Path (SSSP) problem.
Ranking Link-based Ranking (2° generation) Reading 21.
Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media.
1 1 COMP5331: Knowledge Discovery and Data Mining Acknowledgement: Slides modified based on the slides provided by Lawrence Page, Sergey Brin, Rajeev Motwani.
Distributed Computing Seminar Lecture 5: Graph Algorithms & PageRank Christophe Bisciglia, Aaron Kimball, & Sierra Michels-Slettvet Summer 2007 Except.
Data Structures and Algorithms in Parallel Computing Lecture 3.
1 Algorithms CSCI 235, Fall 2015 Lecture 32 Graphs I.
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.
Link Analysis Algorithms Page Rank Slides from Stanford CS345, slightly modified.
Ljiljana Rajačić. Page Rank Web as a directed graph  Nodes: Web pages  Edges: Hyperlinks 2 / 25 Ljiljana Rajačić.
Importance Measures on Nodes Lecture 2 Srinivasan Parthasarathy 1.
大规模数据处理 / 云计算 05 – Graph Algorithm 闫宏飞 北京大学信息科学技术学院 7/22/2014 Jimmy Lin University of Maryland SEWMGroup This work.
Web Mining Link Analysis Algorithms Page Rank. Ranking web pages  Web pages are not equally “important” v  Inlinks.
Hidden Markov Models BMI/CS 576
COMP9313: Big Data Management Lecturer: Xin Cao Course web site:
Big Data Infrastructure
Big Data Infrastructure
Link-Based Ranking Seminar Social Media Mining University UC3M
Network Science: A Short Introduction i3 Workshop
Iterative Aggregation Disaggregation
MapReduce and Data Management
Cloud Computing Lecture #4 Graph Algorithms with MapReduce
Graph Algorithms Ch. 5 Lin and Dyer.
Graph Algorithms Adapted from UMD Jimmy Lin’s slides, which is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.
Lecture 10 Graph Algorithms
Graph Algorithms Ch. 5 Lin and Dyer.
Presentation transcript:

MapReduce and Graph Data Chapter 5 Based on slides from Jimmy Lin’s lecture slides ( (licensed under Creation Commons Attribution 3.0 License)

Why Graphs Graphs can be used to represent many Data problems today: –Social networks: Facebook, Twitter, etc –Communication networks –Biological networks –Transportation, road networks –… Many of these problems deal with Big Data –So, use MapReduce (or in general cluster computing)

Graph DBs Graph databases getting attention! – /14/50-shades-of-graph-how-graph-databases- are-transforming-online-dating/ /14/50-shades-of-graph-how-graph-databases- are-transforming-online-dating/ – -databases-find-answers-for-the-sick-and-their- healers.htmlhttp:// -databases-find-answers-for-the-sick-and-their- healers.html

Graph Algorithms in MapReduce G = (V,E), where –V represents the set of vertices (nodes) –E represents the set of edges (links) –Both vertices and edges may contain additional information

Graphs and MapReduce Graph algorithms typically involve: –Performing computations at each node: based on node features, edge features, and local link structure –Propagating computations: “traversing” the graph Key questions: –How do you represent graph data in MapReduce? –How do you traverse a graph in MapReduce?

Representing Graphs G = (V, E) Two common representations –Adjacency matrix –Adjacency list

Adjacency Matrices Represent a graph as an n x n square matrix M –n = |V| –M ij = 1 means a link from node i to j

Adjacency Matrices: Critique Advantages: –Amenable to mathematical manipulation –Iteration over rows and columns corresponds to computations on outlinks and inlinks Disadvantages: –Lots of zeros for sparse matrices –Lots of wasted space

Adjacency Lists Take adjacency matrices… and throw away all the zeros 1: 2, 4 2: 1, 3, 4 3: 1 4: 1,

Adjacency Lists: Critique Advantages: –Much more compact representation –Easy to compute over outlinks Disadvantages: –Much more difficult to compute over inlinks

Finding the Shortest Path Consider simple case of equal edge weights Solution to the problem can be defined inductively Here’s the intuition: –Define: b is reachable from a if b is on adjacency list of a –DISTANCETO(s) = 0 –For all nodes p reachable from s, DISTANCETO(p) = 1 –For all nodes n reachable from some other set of nodes M, DISTANCETO(n) = 1 + min(DISTANCETO(m), m  M)

Visualizing Parallel BFS n0n0 n0n0 n3n3 n3n3 n2n2 n2n2 n1n1 n1n1 n7n7 n7n7 n6n6 n6n6 n5n5 n5n5 n4n4 n4n4 n9n9 n9n9 n8n8 n8n8

From Intuition to Algorithm Data representation: –Key: node n –Value: d (distance from start), adjacency list (list of nodes reachable from n) –Initialization: for all nodes except for start node, d =  Mapper: –  m  adjacency list: emit (m, d + 1) Sort/Shuffle –Groups distances by reachable nodes Reducer: –Selects minimum distance path for each reachable node –Additional bookkeeping needed to keep track of actual path

Multiple Iterations Needed Each MapReduce iteration advances the “known frontier” by one hop –Subsequent iterations include more and more reachable nodes as frontier expands –Multiple iterations are needed to explore entire graph Preserving graph structure: –Problem: Where did the adjacency list go? –Solution: mapper emits (n, adjacency list) as well

BFS Pseudo-Code

Stopping Criterion How many iterations are needed in parallel BFS (equal edge weight case)? Convince yourself: when a node is first “discovered”, we’ve found the shortest path Now answer the question... –Six degrees of separation?

Graphs and MapReduce Graph algorithms typically involve: –Performing computations at each node: based on node features, edge features, and local link structure –Propagating computations: “traversing” the graph Generic recipe: –Represent graphs as adjacency lists –Perform local computations in mapper –Pass along partial results via outlinks, keyed by destination node –Perform aggregation in reducer on inlinks to a node –Iterate until convergence: controlled by external “driver” –Don’t forget to pass the graph structure between iterations

Random Walks Over the Web Random surfer model: –User starts at a random Web page –User randomly clicks on links, surfing from page to page PageRank –Characterizes the amount of time spent on any given page –Mathematically, a probability distribution over pages PageRank captures notions of page importance –One of thousands of features used in web search –Note: query-independent

Given page x with inlinks t 1 …t n, where –C(t) is the out-degree of t –  is probability of random jump –N is the total number of nodes in the graph PageRank: Defined

Computing PageRank Properties of PageRank –Can be computed iteratively –Effects at each iteration are local Sketch of algorithm: –Start with seed PR i values –Each page distributes PR i “credit” to all pages it links to –Each target page adds up “credit” from multiple in-bound links to compute PR i+1 –Iterate until values converge

Simplified PageRank First, tackle the simple case: –No random jump factor –No dangling links Then, factor in these complexities… –Why do we need the random jump? –Where do dangling links come from?

Sample PageRank Iteration (1) n 1 (0.2) n 4 (0.2) n 3 (0.2) n 5 (0.2) n 2 (0.2) n 1 (0.066) n 4 (0.3) n 3 (0.166) n 5 (0.3) n 2 (0.166) Iteration 1

Sample PageRank Iteration (2) n 1 (0.066) n 4 (0.3) n 3 (0.166) n 5 (0.3) n 2 (0.166) n 1 (0.1) n 4 (0.2) n 3 (0.183) n 5 (0.383) n 2 (0.133) Iteration 2

PageRank in MapReduce n 5 [n 1, n 2, n 3 ]n 1 [n 2, n 4 ]n 2 [n 3, n 5 ]n 3 [n 4 ]n 4 [n 5 ] n2n2 n4n4 n3n3 n5n5 n1n1 n2n2 n3n3 n4n4 n5n5 n2n2 n4n4 n3n3 n5n5 n1n1 n2n2 n3n3 n4n4 n5n5 n 5 [n 1, n 2, n 3 ] n 1 [n 2, n 4 ] n 2 [n 3, n 5 ]n 3 [n 4 ]n 4 [n 5 ] Map Reduce

PageRank Pseudo-Code

Complete PageRank Two additional complexities –What is the proper treatment of dangling nodes? –How do we factor in the random jump factor? Solution: –Second pass to redistribute “missing PageRank mass” and account for random jumps –p is PageRank value from before, p' is updated PageRank value –|G| is the number of nodes in the graph –m is the missing PageRank mass

PageRank Convergence Alternative convergence criteria –Iterate until PageRank values don’t change –Iterate until PageRank rankings don’t change –Fixed number of iterations Convergence for web graphs?

Beyond PageRank Link structure is important for web search –PageRank is one of many link-based features: HITS, SALSA, etc. –One of many thousands of features used in ranking… Adversarial nature of web search –Link spamming –Spider traps –Keyword stuffing –…

Efficient Graph Algorithms Sparse vs. dense graphs Graph topologies

Figure from: Newman, M. E. J. (2005) “Power laws, Pareto distributions and Zipf's law.” Contemporary Physics 46:323–351. Power Laws are everywhere!

Local Aggregation Use combiners! –In-mapper combining design pattern also applicable Maximize opportunities for local aggregation –Simple tricks: sorting the dataset in specific ways