Thursday, 24 April 2014

Wap to check whether a Graph contains parallel edges or not using Incident matrix.



 #include<stdio.h>  
 #include<conio.h>  
 void main()  
 {  
  int i,j,r,count4,count,total,n;  
  int m,a[55][55];  
  int flag=0;  
  printf(" Enter the no of vertices ");  
  scanf ("%d",&m);  
  printf(" Enter the no of edges ");  
  scanf ("%d",&n);  
  printf ("enter the incident \n");  
  for (i=0;i<m;i++)  
  {  
   for(j=0;j<n;j++)  
       {  
        scanf("%d",&a[i][j]);  
       }  
  }  
 for (i=0;i<m;++i)  
  {  
   for(j=i+1;j<n;++j)  
   {  
     for(r=0; r<n; ++r)  
     {  
       if(a[r][i] != a[r][j])  
       {  
             break;  
       }  
     }  
       if(r == n)  
      {  
         printf("col %d is same as col %d\n", i+1, j+1);  
         flag=1;  
      }  
    }  
          if (flag==1)  
          printf (" \n parlle edge found ");  
          else  
          printf(" \n no prall edge found ");  
 getch();  
 }  

No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2016