GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Minimum and maximum degree of directed graph - C

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.

Given the representation of a directed unweighted graph:

typedef struct
{
    int n;//num. of vertices
    void *info[MAX];//information of vertices
    int am[MAX][MAX];//adjacency matrix
}GRAPH;

Write a function

int minDegree(GRAPH*);

and

int maxDegree(GRAPH*);

that return the smallest and the largest degree of given graph.

Write a function with variable number of arguments

GRAPH *f_min(int n,...);

by using the function minDegree() that returns the address of a graph with the smallest degree.

Write a function with variable number of arguments

GRAPH *f_max(int n,...);

by using the function maxDegree() that returns the address of a graph with the largest degree.

n is the number of input graphs.

 

asked Jul 18, 2016 by username_hidden
...