Project 2 22C:021 Computer Science II : Data Structures.

Slides:



Advertisements
Similar presentations
Problem solving with graph search
Advertisements

Single Source Shortest Paths
CS 206 Introduction to Computer Science II 04 / 01 / 2009 Instructor: Michael Eckmann.
Analysis and Modeling of Social Networks Foudalis Ilias.
IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture10.
Data Structures and Algorithms Graphs Single-Source Shortest Paths (Dijkstra’s Algorithm) PLSD210(ii)
CS 206 Introduction to Computer Science II 03 / 27 / 2009 Instructor: Michael Eckmann.
CSE 101- Winter ‘15 Discussion Section January 26th 2015.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
Generated Waypoint Efficiency: The efficiency considered here is defined as follows: As can be seen from the graph, for the obstruction radius values (200,
Information Networks Small World Networks Lecture 5.
CSE 522 – Algorithmic and Economic Aspects of the Internet Instructors: Nicole Immorlica Mohammad Mahdian.
Networks. Graphs (undirected, unweighted) has a set of vertices V has a set of undirected, unweighted edges E graph G = (V, E), where.
Graph II MST, Shortest Path. Graph Terminology Node (vertex) Edge (arc) Directed graph, undirected graph Degree, in-degree, out-degree Subgraph Simple.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
1 Greedy 2 Jose Rolim University of Geneva. Algorithmique Greedy 2Jose Rolim2 Examples Greedy  Minimum Spanning Trees  Shortest Paths Dijkstra.
Chapter 9 Graph algorithms. Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Data Structures Heaps and Graphs i206 Fall 2010 John Chuang Some slides adapted from Marti Hearst, Brian Hayes, or Glenn Brookshear.
Shortest Paths Definitions Single Source Algorithms –Bellman Ford –DAG shortest path algorithm –Dijkstra All Pairs Algorithms –Using Single Source Algorithms.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
1 8-ShortestPaths Shortest Paths in a Graph Fundamental Algorithms.
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Advanced Topics in Data Mining Special focus: Social Networks.
Shortest Paths Definitions Single Source Algorithms
CS 206 Introduction to Computer Science II 11 / 05 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 03 / 25 / 2009 Instructor: Michael Eckmann.
Nondecreasing Paths in Weighted Graphs Or: How to optimally read a train schedule Virginia Vassilevska.
More Algorithm Examples Mani Chandy
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
1 Shortest Path Algorithms. 2 Routing Algorithms Shortest path routing What is a shortest path? –Minimum number of hops? –Minimum distance? There is a.
The Shortest Path Problem
Theory of Computing Lecture 7 MAS 714 Hartmut Klauck.
Shortest Path Algorithms. Kruskal’s Algorithm We construct a set of edges A satisfying the following invariant:  A is a subset of some MST We start with.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Graph Algorithms: Minimum.
CSCI-455/552 Introduction to High Performance Computing Lecture 18.
CS223 Advanced Data Structures and Algorithms 1 The Bellman-Ford Shortest Path Algorithm Neil Tang 03/11/2010.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Dijkstras Algorithm Named after its discoverer, Dutch computer scientist Edsger Dijkstra, is an algorithm that solves the single-source shortest path problem.
Algorithms: Design and Analysis Summer School 2013 at VIASM: Random Structures and Algorithms Lecture 3: Greedy algorithms Phan Th ị Hà D ươ ng 1.
Graph (II) Shortest path, Minimum spanning tree GGuy
WAN technologies and routing Packet switches and store and forward Hierarchical addresses, routing and routing tables Routing table computation Example.
Shortest Path Problem Weight of the graph –Nonnegative real number assigned to the edges connecting to vertices Weighted graphs –When a graph.
Algorithm Course Dr. Aref Rashad February Algorithms Course..... Dr. Aref Rashad Part: 6 Shortest Path Algorithms.
Gennaro Cordasco - How Much Independent Should Individual Contacts be to Form a Small-World? - 19/12/2006 How Much Independent Should Individual Contacts.
Shortest Path in Weighted Graph : Dijkstra’s Algorithm.
D IJKSTRA ' S ALGORITHM. S INGLE -S OURCE S HORTEST P ATH P ROBLEM Single-Source Shortest Path Problem - The problem of finding shortest paths from a.
Kruskal’s and Dijkstra’s Algorithm.  Kruskal's algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted.
1 Prim’s algorithm. 2 Minimum Spanning Tree Given a weighted undirected graph G, find a tree T that spans all the vertices of G and minimizes the sum.
Length of a Path The weight (length) of a path is the sum of the weights of its edges. adcbe Path p: Edge weights: w(a, b) = 7, w(b, c) = 2, w(c,
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 10.
Project 1 : Phase 1 22C:021 CS II Data Structures.
Graph Searching CSIT 402 Data Structures II. 2 Graph Searching Methodology Depth-First Search (DFS) Depth-First Search (DFS) ›Searches down one path as.
Graphs – Part III CS 367 – Introduction to Data Structures.
Lecture 13 Shortest Path.
Graph Algorithms BFS, DFS, Dijkstra’s.
Minimum Spanning Trees
Shortest Path Graph represents highway system Edges have weights
Discussion section #2 HW1 questions?
Greedy Algorithms / Dijkstra’s Algorithm Yin Tat Lee
Minimum Spanning Tree Algorithms
Advanced Computer Networks
Fundamental Structures of Computer Science II
The Bellman-Ford Shortest Path Algorithm Neil Tang 03/27/2008
CSE 373: Data Structures and Algorithms
Brad Karp UCL Computer Science
CSE 417: Algorithms and Computational Complexity
Lecture 12 Shortest Path.
CSE 373: Data Structures and Algorithms
Data Structures and Algorithm Analysis Lecture 8
Presentation transcript:

Project 2 22C:021 Computer Science II : Data Structures

Power-law Distribution The power-law degree distribution captures the phenomena that a small number of vertices in a graph have high degree, whereas most of the vertices have very small degree Captures phenomenon prevalent in real networks

Requirements Run 3 experiments Capture results from experiments and prepare a deliverable  Details on deliverables will be up soon.

Experiment 1 Run experiments to support the hypothesis:  “random graphs generated in Project 1 do not satisfy the power-law distribution” Write a method  int [] degreeDistribution ()  This method returns the distribution such that element i holds the number of vertices with degree i. Use results to determine if the hypothesis holds.

Experiment 2 Implement a graph similar to one from Project 1  Randomly generate graph  Instead of random rewiring use preferential rewiring. Project description explains these terms well Repeat tests from Experiment 1 on this new graph Determine if this new graph generation mechanism supports power-law distribution

How do I determine probabilities? Experiment 2 expects you to wire vertices depending on how “popular” they are. Popularity is defined as the degree of a vertex  Higher the degree, the more popular a vertex is You connect to vertices depending on their degree (preferential rewiring) This is different from Project 1, where a random non-neighbor was chosen to replace an edge (uniform rewiring)

How do I determine probabilities? Determine a set Z that contains all non- neighbors of v  v is the vertex you're trying to wire For each z in Z  compute probability of that vertex being picked as probZ [i] = (degree (Z[0]) + degree (Z[1])... +degree(Z[i])) / D  D is the sum of all degrees of vertices in Z

How do I determine probabilities? Now, generate a random real number in the range 0 to 1 Find the first i such that p ≤ probZ[i]  Note that probZ is a non-decreasing seires. Connect to Z[i]

Experiment 3 What are we trying to determine?  Can verticies in our models use “local information” to connect to a different vertex Run experiments on both  Uniform rewiring  Preferential rewiring This experiment is not difficult to figure  See project description on the course webpage.

Finding distances between vertices Use greedy algorithm to find distance between two vertices (in hops)  On a vertex v find a vertex w that is closer to destination than v is, and use w as the next hop “Closer”: Remember: coordinates of each vertex are available in graph Use breadth-first-search to determine shortest path hop distance Use Dijkstra's shortest path algorithm to determine the shortest path Euclidean-distance

Dijkstra's shortest path algorithm S <- emptyset d[v] <- infinity for all v in V d[s] <- 0 initialize the binary heap H to V while(H is non-empty)do { v <- deleteMin(H) S <- S union v for(each u, neighbor of v)do { if(d[u] > d[v] + w(u, v)) { d[u] <- d[v] + w(u, v) changePriority(H, u, d[u]) }

Dijkstra's shortest path algorithm changePriority() will run in O(logn)  But... Provided that we know where u is within H Since H is an array this might take O(n) time  O(n) is not good  One approach to fix this: Have each node store its index in H When changePriority() gets u, it can fetch u.heapPosition Make sure you update u.heapPosition whenever you perform a heap operation