subject

Java Question:

* blanancedFriendships
*
* say the 'balanceFactor' of a friendship is the difference between the two friends'
* popularities. If two friends have the same popularity, then the balanceFactor would
* be 0. If one of the friends had N total friends and the other had 1, then the
* balanceFactor would be N-1 - it would be a 'lopsided' friendship
*
* the maxBalanceFactor for a graph is the largest balanceFactor for the graph
* (note it would always be >=0)
*
* B-Level:
* determine the maximum balanceFactor for the graph.
* store the answer in the maxBalanceFactor instance variable
*
* A-Level
*
* determine the number of 'friendships' for which the balanceFactor is largest for the graph
* store the answer in the instance variable
*
* this level is optional. if you choose NOT to complete it, simply leave the assignment
* statement to as given below.
*
* Example: if all vertices have the same number of friends, then all popularites would be the same
* so all balanceFactors would be 0 - the maxBalanceFactor would be 0
*
* A-Level: since all balanceFactors are the same,
* all friendships would have the maximum balanceFactor
*
* Example: if one vertex 'a' was connected to 5 other vertices (b, c,d, e,f) and there were no other
* edges, then a's popularity would be 5, all the others would be 1. The balanceFactor for
* all friendships would be 4. the maxBalanceFactor would be 4
*
* A-Level: would be 5.
*
*/
private void blanancedFriendships(Graph G) {

maxBalanceFactor = -1; // ToDo 4 fix this

= -1; // toDo 5 optiona A Level 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 ; // 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 () {
return ;
}
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;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:20
Wireless communications is likely to be viewed as an essential part of an enterprise network infrastructure when: select one: a. mobile communication is needed b. communication facilities must be installed at low initial cost c. communication must take place in a hostile or difficult terrain that makes wired communication difficult or impossible d. the same information must be broadcast to many locations
Answers: 1
question
Computers and Technology, 22.06.2019 20:00
Need asap write a short paper describing the history and differences between six sigma, waterfall, agile, and scrum models. understanding these models can give you a good idea of how diverse and interesting it development projects can be. describe what the rationale for them is and describe their key features. describe the history behind their development. at least 400 words
Answers: 1
question
Computers and Technology, 23.06.2019 00:30
Quic which one of the following is the most accurate definition of technology? a electronic tools that improve functionality b electronic tools that provide entertainment or practical value c any type of tool that serves a practical function d any type of tool that enhances communication
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
Java Question:

* blanancedFriendships
*
* say the 'balanceFactor' of a frien...
Questions
question
English, 04.08.2021 07:40
question
History, 04.08.2021 07:40
question
Mathematics, 04.08.2021 07:40
question
English, 04.08.2021 07:40
question
Mathematics, 04.08.2021 07:40
question
Mathematics, 04.08.2021 07:40