Public int comparetoobject o 6 then use extfriend as

Info icon This preview shows pages 6–9. Sign up to view the full content.

View Full Document Right Arrow Icon
public int compareTo(Object o){ .. } } 6
Image of page 6

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
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.uni-konstanz.de/algo/publications/b-fabc-01.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
Image of page 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 0 a clique in G such that C C 0 . Implement the class BronKerbosch.java . The interface is given as: public BronKerbosch(); public Set<Set<Friend>> maxCliques(Map<String, Friend> people); You may implement any helper methods as you see fit. The maxCliques method should return the set of all maximal cliques (each of which is in turn a set of friends) present in the graph. Bron-Kerbosch is a recursive backtracking algorithm that is reasonably simple. It maintains three sets. The first set R will be in the clique, the second set P are vertices to add and recurse upon, and the third set X, are vertices prohibited from being in the clique (to prevent duplicates max cliques from being reported).
Image of page 8

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern