Question Write client functions to determine: a. if there is an edge between vertices b. if three vertices do NOT make up a trio (triangle) c. the average vertex-popularity of a graph d. the number of vertices within distance D of a given vertex

SET1W4 The Asker · Computer Science

Transcribed Image Text: Write client functions to determine: a. if there is an edge between vertices b. if three vertices do NOT make up a trio (triangle) c. the average vertex-popularity of a graph d. the number of vertices within distance D of a given vertex
More
Transcribed Image Text: Write client functions to determine: a. if there is an edge between vertices b. if three vertices do NOT make up a trio (triangle) c. the average vertex-popularity of a graph d. the number of vertices within distance D of a given vertex
Community Answer
T0396N

// function for finding minimum no. of edge // using BFS int minEdgeBFS(vector <int> edges[], int u,                               int v, int n) {     // visited[n] for keeping track of visited     // node in BFS     vector<bool> visited(n, 0);        // Initialize distances as 0     vector<int> distance(n, 0);        // queue to do BFS.     queue <int> Q;     distance[u] = 0;        Q.push(u);     visited[u] = true;     while (!Q.empty())     {         int x = Q.front();         Q.pop();            for (int i=0; i<edges[x].size(); i++)         {             if (visited[edges[x][i]])                 continue;                // update distance for i             distance[edges[x][i]] = distance[x] + 1;  &#16 ... See the full answer