Big Data Infrastructure Week 5: Analyzing Graphs (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United.

Slides:



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

Graphs (Part II) Shannon Quinn (with thanks to William Cohen and Aapo Kyrola of CMU, and J. Leskovec, A. Rajaraman, and J. Ullman of Stanford University)
LIBRA: Lightweight Data Skew Mitigation in MapReduce
Crawling, Ranking and Indexing. Organizing the Web The Web is big. Really big. –Over 3 billion pages, just in the indexable Web The Web is dynamic Problems:
Parallel Computing MapReduce Examples Parallel Efficiency Assignment
大规模数据处理 / 云计算 Lecture 4 – Mapreduce Algorithm Design 彭波 北京大学信息科学技术学院 4/24/2011 This work is licensed under a Creative.
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
Link Analysis: PageRank
Spark: Cluster Computing with Working Sets
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.
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.
MapReduce Algorithms CSE 490H. Algorithms for MapReduce Sorting Searching TF-IDF BFS PageRank More advanced algorithms.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland Tuesday, June 29, 2010 This work is licensed.
Homework 2 In the docs folder of your Berkeley DB, have a careful look at documentation on how to configure BDB in main memory. In the docs folder of your.
Parallel K-Means Clustering Based on MapReduce The Key Laboratory of Intelligent Information Processing, Chinese Academy of Sciences Weizhong Zhao, Huifang.
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.
Lecture 2 – MapReduce CPE 458 – Parallel Programming, Spring 2009 Except as otherwise noted, the content of this presentation is licensed under the Creative.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz University of Maryland MLG, January, 2014 Jaehwan Lee.
CS506/606: Problem Solving with Large Clusters Zak Shafran, Richard Sproat Spring 2011 Introduction URL:
Advanced Topics: MapReduce ECE 454 Computer Systems Programming Topics: Reductions Implemented in Distributed Frameworks Distributed Key-Value Stores Hadoop.
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:
USING HADOOP & HBASE TO BUILD CONTENT RELEVANCE & PERSONALIZATION Tools to build your big data application Ameya Kanitkar.
1 The Map-Reduce Framework Compiled by Mark Silberstein, using slides from Dan Weld’s class at U. Washington, Yaniv Carmeli and some other.
MapReduce and Graph Data Chapter 5 Based on slides from Jimmy Lin’s lecture slides ( (licensed.
Ahsanul Haque *, Swarup Chandra *, Latifur Khan * and Michael Baron + * Department of Computer Science, University of Texas at Dallas + Department of Mathematical.
Design Patterns for Efficient Graph Algorithms in MapReduce Jimmy Lin and Michael Schatz (Slides by Tyler S. Randolph)
Map-Reduce-Merge: Simplified Relational Data Processing on Large Clusters Hung-chih Yang(Yahoo!), Ali Dasdan(Yahoo!), Ruey-Lung Hsiao(UCLA), D. Stott Parker(UCLA)
MapReduce Kristof Bamps Wouter Deroey. Outline Problem overview MapReduce o overview o implementation o refinements o conclusion.
Graph Algorithms. Graph Algorithms: Topics  Introduction to graph algorithms and graph represent ations  Single Source Shortest Path (SSSP) problem.
CS 347Notes101 CS 347 Parallel and Distributed Data Processing Distributed Information Retrieval Hector Garcia-Molina Zoltan Gyongyi.
Most of contents are provided by the website Graph Essentials TJTSD66: Advanced Topics in Social Media.
MapReduce Algorithm Design Based on Jimmy Lin’s slides
MapReduce and Data Management Based on slides from Jimmy Lin’s lecture slides ( (licensed.
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.
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.
Big Data Infrastructure Week 2: MapReduce Algorithm Design (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0.
Big Data Infrastructure Week 3: From MapReduce to Spark (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0.
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.
Big Data Infrastructure Week 8: Data Mining (1/4) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.
Big Data Infrastructure Week 11: Analyzing Graphs, Redux (1/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0.
Jimmy Lin and Michael Schatz Design Patterns for Efficient Graph Algorithms in MapReduce Michele Iovino Facoltà di Ingegneria dell’Informazione, Informatica.
Big Data Infrastructure Week 9: Data Mining (4/4) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States.
Lecture 3 – MapReduce: Implementation CSE 490h – Introduction to Distributed Computing, Spring 2009 Except as otherwise noted, the content of this presentation.
Big Data Infrastructure
Big Data Infrastructure
Big Data Infrastructure
Big Data Infrastructure
Big Data Infrastructure
Map Reduce.
CSE 454 Advanced Internet Systems University of Washington
MapReduce Simplied Data Processing on Large Clusters
湖南大学-信息科学与工程学院-计算机与科学系
Cse 344 May 4th – Map/Reduce.
MapReduce and Data Management
CSE 454 Advanced Internet Systems University of Washington
Cloud Computing Lecture #4 Graph Algorithms with MapReduce
MapReduce Algorithm Design Adapted from Jimmy Lin’s slides.
CSE 454 Advanced Internet Systems University of Washington
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.
MAPREDUCE TYPES, FORMATS AND FEATURES
Graph Algorithms Ch. 5 Lin and Dyer.
Presentation transcript:

Big Data Infrastructure Week 5: Analyzing Graphs (2/2) This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States See for details CS 489/698 Big Data Infrastructure (Winter 2016) Jimmy Lin David R. Cheriton School of Computer Science University of Waterloo February 4, 2016 These slides are available at

Source: Wikipedia (Wave) Single Source Shortest Path

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 (nodes reachable from n) Initialization: for all nodes except for start node, d =  Mapper:  m  adjacency list: emit (m, d + 1) Remember to also emit distance to yourself 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 “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 Ugh! This is ugly!

Implementation Practicalities reduce map HDFS Convergence?

Application: Social Search Source: Wikipedia (Crowd)

Social Search When searching, how to rank friends named “John”? Assume undirected graphs Rank matches by distance to user Naïve implementations: Precompute all-pairs distances Compute distances at query time Can we do better?

All-Pairs? Floyd-Warshall Algorithm: difficult to MapReduce-ify… Multiple-source shortest paths in MapReduce: run multiple parallel BFS simultaneously Assume source nodes {s 0, s 1, … s n } Instead of emitting a single distance, emit an array of distances, with respect to each source Reducer selects minimum for each element in array Does this scale?

Landmark Approach (aka sketches) Select n seeds {s 0, s 1, … s n } Compute distances from seeds to every node: What can we conclude about distances? Insight: landmarks bound the maximum path length Lots of details: How to more tightly bound distances How to select landmarks (random isn’t the best…) Use multi-source parallel BFS implementation in MapReduce! A=[2, 1, 1] B =[1, 1, 2] C=[4, 3, 1] D=[1, 2, 4] Nodes Distances to seeds

Graphs and MapReduce A large class of graph algorithms 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

PageRank (The original “secret sauce” for evaluating the importance of web pages) (What’s the “Page” in PageRank?)

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 Correspondence to human intuition? One of thousands of features used in web search

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 X X t1t1 t1t1 t2t2 t2t2 tntn tntn …

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 nodes Then, factor in these complexities… Why do we need the random jump? Where do dangling nodes 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

PageRank vs. BFS Map Reduce PageRankBFS PR/Nd+1 summin

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 N is the number of nodes in the graph m is the missing PageRank mass Additional optimization: make it a single pass!

Implementation Practicalities Convergence? reduce map HDFS map HDFS Ugh. Spark to the rescue?

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? Not a straightforward question Watch out for link spam and the perils of SEO: Link farms Spider traps …

Beyond PageRank Variations of PageRank Weighted edges Personalized PageRank Variants on graph random walks Hubs and authorities (HITS) SALSA

Applications Static prior for web ranking Identification of “special nodes” in a network Link recommendation Additional feature in any machine learning problem

More Implementation Practicalities How do you actually extract the webgraph? Lots of details…

Source:

MapReduce Sucks Java verbosity Hadoop task startup time Stragglers Needless graph shuffling Checkpointing at each iteration Spark to the rescue?

Implementation Practicalities Convergence? reduce map HDFS map HDFS

Iterative Algorithms Source: Wikipedia (Water wheel)

In-Mapper Combining Use combiners Perform local aggregation on map output Downside: intermediate data is still materialized Better: in-mapper combining Preserve state across multiple map calls, aggregate messages in buffer, emit buffer contents at end Downside: requires memory management setup map cleanup buffer Emit all key-value pairs at once

Better Partitioning Default: hash partitioning Randomly assign nodes to partitions Observation: many graphs exhibit local structure E.g., communities in social networks Better partitioning creates more opportunities for local aggregation Unfortunately, partitioning is hard! Sometimes, chick-and-egg… But cheap heuristics sometimes available For webgraphs: range partition on domain-sorted URLs

Schimmy Design Pattern Basic implementation contains two dataflows: Messages (actual computations) Graph structure (“bookkeeping”) Schimmy: separate the two dataflows, shuffle only the messages Basic idea: merge join between graph structure and messages ST both relations sorted by join key S1S1 T1T1 S2S2 T2T2 S3S3 T3T3 both relations consistently partitioned and sorted by join key

S1S1 T1T1 Do the Schimmy! Schimmy = reduce side parallel merge join between graph structure and messages Consistent partitioning between input and intermediate data Mappers emit only messages (actual computation) Reducers read graph structure directly from HDFS S2S2 T2T2 S3S3 T3T3 Reducer intermediate data (messages) intermediate data (messages) intermediate data (messages) from HDFS (graph structure) from HDFS (graph structure) from HDFS (graph structure)

Experiments Cluster setup: 10 workers, each 2 cores (3.2 GHz Xeon), 4GB RAM, 367 GB disk Hadoop on RHELS 5.3 Dataset: First English segment of ClueWeb09 collection 50.2m web pages (1.53 TB uncompressed, 247 GB compressed) Extracted webgraph: 1.4 billion links, 7.0 GB Dataset arranged in crawl order Setup: Measured per-iteration running time (5 iterations) 100 partitions From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

Results “Best Practices” From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

Results +18% 1.4b 674m From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

Results +18% -15% 1.4b 674m From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

Results +18% -15% -60% 1.4b 674m 86m From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

Results +18% -15% -60% -69% 1.4b 674m 86m From: Jimmy Lin and Michael Schatz. Design Patterns for Efficient Graph Algorithms in MapReduce. Proceedings of the Eighth Workshop on Mining and Learning with Graphs Workshop (MLG-2010)

MapReduce Sucks Java verbosity Hadoop task startup time Stragglers Needless graph shuffling Checkpointing at each iteration What have we fixed?

Let’s Spark! reduce HDFS (omitting the second MapReduce job for simplicity; no handling of dangling links) … map HDFS reduce map HDFS reduce map HDFS

reduce HDFS … map reduce map reduce map

reduce HDFS map reduce map reduce map Adjacency ListsPageRank MassAdjacency ListsPageRank MassAdjacency ListsPageRank Mass …

join HDFS map join map join map Adjacency ListsPageRank MassAdjacency ListsPageRank MassAdjacency ListsPageRank Mass …

join … HDFS Adjacency ListsPageRank vector flatMap reduceByKe y PageRank vector flatMap reduceByKe y

join … HDFS Adjacency ListsPageRank vector flatMap reduceByKe y PageRank vector flatMap reduceByKe y Cache!

MapReduce vs. Spark Source:

Spark to the Rescue! Java verbosity Hadoop task startup time Stragglers Needless graph shuffling Checkpointing at each iteration What have we fixed?

join … HDFS Adjacency ListsPageRank vector flatMap reduceByKe y PageRank vector flatMap reduceByKe y Cache! Still not particularly satisfying?

Source: Stay Tuned!

Source: Wikipedia (Japanese rock garden) Questions? Remember: Assignment 4 due next Tuesday at 8:30am