Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- //El vertice 3
- int grafo[6][6]={{1,1,1,0,0,1},
- {1,0,1,1,0,0},
- {0,0,0,0,0,0},
- {0,1,1,1,0,1},
- {1,0,1,0,0,0},
- {0,1,1,1,0,0}};
- int filaEsCeroycolumnaesUno(int vert,int nvertices){
- for (int j=0;j<nvertices;j++){
- if (vert==j && grafo[vert][j]==1)
- return 0;
- if (vert!=j && (grafo[j][vert]!=1 || grafo[vert][j]!=0))
- return 0;
- }
- return 1;
- }
- int existeij(int nvertices){
- for (int i=0;i<nvertices;i++){
- if (filaEsCeroycolumnaesUno(i,nvertices))
- return 1;
- }
- return 0;
- }
- int main(){
- int nvertices=6;
- printf("%d\n",existeij(nvertices));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment