Advertisement
amrin26

Graph 1

Feb 17th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include<iostream>
  2.  using namespace std;
  3.  
  4.  int main()
  5.  {
  6.      int ne;
  7.      cin>>ne;
  8.      int adj[ne+1][ne+1];
  9.  
  10.      for(int r=0;r<=8;r++)
  11.      {
  12.               for(int c=0;c<=8;c++)
  13.               {
  14.                   adj[r][c] = 0;
  15.               }
  16.  
  17.      }
  18.  
  19.      for(int i=1; i<=ne; i++)
  20.      {
  21.          int u,v;
  22.          cin>>u>>v;
  23.          adj[u][v]=1;
  24.          adj[v][u]=1;
  25.      }
  26.  
  27.        for(int r=0;r<=8;r++)
  28.      {
  29.               for(int c=0;c<=8;c++)
  30.               {
  31.                   cout<<adj[r][c] <<" ";
  32.               }
  33.               cout<<endl;
  34.  
  35.      }
  36.      return 0;
  37.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement