Download presentation
Presentation is loading. Please wait.
Published byKenneth Curtis Modified over 9 years ago
1
Project 2 22C:021 Computer Science II : Data Structures
2
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
3
Requirements Run 3 experiments Capture results from experiments and prepare a deliverable Details on deliverables will be up soon.
4
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.
5
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
6
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)
7
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
8
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]
9
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.
10
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
11
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]) }
12
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.