Program No10
Program No10
Program No. – 10
Program:
//This program is belonging to Mohd Kaleem
#include <stdio.h>
#define MAX_VERTICES 50
int checkGraphDirection(int
adjacencyMatrix[MAX_VERTICES][MAX_VERTICES], int numVertices) {
Mohd Kaleem (22DCS067)
int i, j;
int main() {
int adjacencyMatrix[MAX_VERTICES][MAX_VERTICES];
int numVertices, i, j;
if (checkGraphDirection(adjacencyMatrix, numVertices)) {
printf("The graph is directed.\n");
} else {
Mohd Kaleem (22DCS067)
return 0;
}
Output:
Enter the number of vertices : 3
Enter the adjacency matrix:
011
101
110
The graph is undirected.
Test Case:
Test
Case Description Expected Behavior
ERROR!
1. Enter the number of vertices : 56 Error: Invalid number of vertices.
ERROR!
3. Enter the number of vertices : a Error: Invalid number of vertices.
ERROR!
Enter the adjacency matrix:
Error: Invalid input value. Please enter only 0 or
4. Enter the number of vertices : 1.2 1.