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, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
question
Computers and Technology, 24.06.2019 00:00
The gene form of a trait is called a(n) 
Answers: 2
You know the right answer?
Java Question:

* blanancedFriendships
*
* say the 'balanceFactor' of a frien...
Questions
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Geography, 13.09.2020 21:01
question
Social Studies, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
English, 13.09.2020 21:01
question
Social Studies, 13.09.2020 21:01
question
Social Studies, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Health, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
History, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
question
Mathematics, 13.09.2020 21:01
Questions on the website: 13722360