- #1
username_unknown
- 2
- 0
Homework Statement
Given the representation of directed unweighted graph:
Code:
typedef struct
{
int n;//num. of vertices
void *info[MAX];//information of vertices
int am[MAX][MAX];//adjacency matrix
}GRAPH;
Write a function
Code:
int minDegree(GRAPH*);
Code:
int maxDegree(GRAPH*);
Write a function with variable number of arguments
Code:
GRAPH *f_min(int n,...);
Write a function with variable number of arguments
Code:
GRAPH *f_max(int n,...);
n is the number of input graphs.
2. The attempt at a solution
Maximum (minimum) degree of a directed graph is the total number of in-degree and out-degree edges of a vertex that has the largest (smallest) number of edges, with loops counted twice.
So, the algorithm form finding the minimum and maximum degree of a directed graph is to:
1. for each vertex, count the number of connecting edges, and if an edge is a loop, then multiply by two.
2. return the smallest and the largest count.
Could someone please suggest some code, because I am really stuck in implementation of this program?