I'm trying to create a project about graphs and using BFS in c. But I have some problems from reading and also writing after when I fill the nodes from the command screen. If you can help about it I would be appreciated.
void createGraph(){
int i,j;
for(i=0;i<100;i++){
for(j=0;j<100;j++){
a[i][j]=0;
}
}
i=0;j=0;
while(1){
printf("Enter the from n to vertices (Enter -1 to stop): ");
scanf("%d",&i);
scanf("%d", &j);
if(i == -1){
return;
}
else{
a[i][j]=1;
}
}
}
Now I can just enter the nodes from the command screen and do the works, so how can I open the file, print the edges and nodes to this file, and after that reading from it when I need.