Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** * CountNumberOfTrios * * determine how many groups of 3 vertices (u,v,w) are directly to connected to each other * Each group should be

/**

* CountNumberOfTrios

*

* determine how many groups of 3 vertices (u,v,w) are directly to connected to each other

* Each group should be counted only one time.

*

* the functions stores the computed result in the numberOfTrios instance variable

*/

private void countNumberOfTrios(Graph G) {

numberOfTrios = -1;// ToDo 1 fix this

}

CLASS

public class Friendship {

private int numberOfTrios; // the results of the computations are stored

private int[] indirectPopularity; // in these instance variables.

private double averageNumberOfFriends; // the values of the variables may be accessed using

private int [] socialRank; // the corresponding 'accessor' functions below.

public int indirectPopularity(int v) { // accessor functions

return indirectPopularity[v];

}

public int numberOfTrios() {

return numberOfTrios;

}

public double averageNumberOfFriends() {

return averageNumberOfFriends;

}

public int socialRank(int v) {

return socialRank[v];

}

// ---end accessors

/**

* degree

*

* Suggestion. copy the degree function from the textbook.

* you may find it a useful utility function for your functions

*/

private int degree(Graph G, int v) {

int degree=0;

for(int w: G.adj(v)) degree++;

return degree; // fix this if you want to use it

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

LO2 Identify components of workflow analysis.

Answered: 1 week ago