Question: Your task is to implement the Ego class in Ego.java file to return the more k powerful personal networks in the facebook data set by

Your task is to implement the Ego class in Ego.java file to return the more k powerful personal networks in the facebook data set by writing the following APIs.

? public Ego(Graph g): this is the constructor to build the data structure that stores all ego networks from graph g in a sorted order

? public List top(int k): this is the method to return the top k ego networks with the largest number of edges. The nested class egonet is provided, which contains the egonet graph and its center.

import java.util.*;

public class Ego {

// place your code here

// the nested class used to define a egonet

public static class egonet {

int center; // center of the egonet

Graph G; // subgraph that represents the egonet

egonet(int c, Graph g) {

center = c;

G = g;

}

int getCenter() {

return center;

}

Graph getG() {

return G;

}

}

public Ego(Graph g) {

// place your code here

}

public List top(int k) {

// place your code here

return null;

}

}

Your task is to implement the Ego class in Ego.java file to

\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!