This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: The algorithm relies on a priority queue that orders nodes in the graph by their distance from the source node. You may use the java PriorityQueue class in your implementation of the algo rithm. The type of the elements in a PriorityQueue must implement the Comparable interface; we suggest creating an inner class in Dijkstra.java that extends the Friend class and (by default, since it is a subclass of Friend) implements Comparable. For example: class ExtFriend extends Friend { ... public int compareTo(Object o){ .. } } 6 Then use ExtFriend as your PriorityQueue type. You will return a DijkstraPair, which stores all shortest path distances as well as predecessors, as explained in the provided code. 3.2.3 ClosenessCentrality.java 30pts Closeness centrality is a measure of how close a node is to all other nodes in the graph, measured by the reciprocal of the sum of the distances between a node and all of the other nodes in the graph. This is expressed through the following formula: CC ( u ) = 1 ∑ v ∈ N \ u dist ( u,v ) where N is the set of all nodes in the graph, and dist ( u,v ) is the shortest path distance between u and v . Your job is to write a function that returns this metric for a given node. To complete this task you should draw on previous tasks. The method signature should be as follows: public static double Centrality(Set<Friend> people, Friend source) 3.3 Betweeness.java Extra Credit  35pts EC (Note: this problem is not due until the final submission deadline, rather than milestone 2) In the study of networks and graphs, many metrics of the connectedness or importance of a node in a larger network have been developed. One such metric is betweenness centrality. We define betweenness centrality for node v as follows: C B ( v ) = X s 6 = v 6 = t σ st ( v ) σ st where σ st is the number of shortest paths from node s to node t and σ st ( v ) is the number of shortest paths from node s to node t that pass through v . You will write code to compute betweenness centrality for particular nodes in a given friend graph. Complete the methods in the skeleton code for the file Betweeness.java . While there are many ways to compute betweenness centrality (you are welcome to use anything that works), we suggest you use Brandes’ algorithm because of its relative simplicity and high efficiency in both time and space. Read the paper at http://www.inf.unikonstanz.de/algo/publications/bfabc01.pdf to understand the reasoning behind the algorithm and implement it. You should treat the graph as unweighted for the purpose of finding betweenness centrality – shortest paths are paths which pass through the fewest edges. 7 4 Phase 3: Advanced Graph Algorithms, 45pts total 4.1 BronKerbosch.java 45pts The Bron Kerbosch algorithm finds maximal cliques in undirected graphs. Recall: Given G = ( V,E ) ,C ⊆ V is called a clique if ∀ u,v ∈ C,u 6 = v then ( u,v ) ∈ E C , a clique in G = ( V,E ) is called a maximal clique if 6 ∃ C a clique in G such that C ⊂ C ....
View
Full Document
 Spring '09
 TANNEN
 Algorithms, Graph Theory, Data Structures, JSON, Shortest path problem, friend graph

Click to edit the document details