Question: Java Question: /** * determineIndirectPopularity * * concept: people accrue social status from the people they associate with. * and while an individual may not

Java Question:

/** * determineIndirectPopularity * * concept: people accrue social status from the people they associate with. * and while an individual may not be 'popular', they may achieve some level * of popularity - indirectly - through the popularity of their friends. This * is the notion of 'indirectPopularity' * * for each vertex v, determine the maximum popularity of its friends * * the IndirectPopularity of a vertex with no friends is 0 * * store the answer in indirectPopularity[v] */

private void determineIndirectPopularity(Graph G) { for (int v = 0; v < G.V(); v++ ) indirectPopularity[v] = -1; // ToDo 2 fix this }

More information that might be useful:

public class SocialCircles { private int numberOfTrios; // the results of the computations are stored private int[] indirectPopularity; // in these instance variables. private int maxBalanceFactor; // the values of the variables may be accessed by clients using private int numberOfMostUnbalancedFriendships; // the corresponding 'accessor' functions below. private int [] socialRank;

// accessor functions public int getIndirectPopularity(int v) { // getIndirectPopularity of vertex v return indirectPopularity[v]; } public int getNumberOfTrios() { return numberOfTrios; } public int getMaxBalanceFactor() { return maxBalanceFactor; } public int getNumberOfMostUnBlanancedFriendships() { return numberOfMostUnbalancedFriendships; } public int getSocialRank(int v) { // get getSocialRank of vertex v return socialRank[v]; }

// ---end accessors

/** * degree * * Suggestion. copy the degree function (or see if you can write it from scratch) from the textbook. * you may find it a useful utility function for your functions */ public static int degree(Graph G, int v) { int degree = 0; for (int w : G.adj(v)) degree++; return degree; }

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 Databases Questions!