How to implement Directed Graph In C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to implement Directed Graph In C

I'm trying to implementing a Directed graph in c program, which I have problem with. Please help me with this problem #include <stdio.h> #define n 1000 //the func void func_adj(int i, int j){ arr[i][j]=1; arr[j][i]=1; } int main() { int arr[n][n],i,j,x; printf("Enter The Node Numbers You Want To Add:"); scanf("%d",&x); //here is the input goes to for(i=0;i<x;i++){ for(j=0;j<x;j++){ scanf("%d",&arr[i][j]); } } //here we call the func adjency chekck for(i=0;i<x;i++){ for(j=0;j<x;j++){ func_adj(arr[i][j]); } } //printing the derected graph of adj mat for(i=0;i<x;i++){ for(j=0;j<x;j++){ printf("%d",arr[i][j]); } } return 0; }

11th May 2020, 8:47 PM
Fahim Rayhan
Fahim Rayhan - avatar
1 Answer
+ 1
Please specify problem....
17th May 2020, 4:49 AM
DeWill
DeWill - avatar