Skip to content

Instantly share code, notes, and snippets.

@shawon100
Created January 26, 2017 09:15
Show Gist options
  • Select an option

  • Save shawon100/37b76171e4df803ed38d51e792fc6193 to your computer and use it in GitHub Desktop.

Select an option

Save shawon100/37b76171e4df803ed38d51e792fc6193 to your computer and use it in GitHub Desktop.
Adjacent Matrix
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n,e,u,v,g[100][100];
cin>>n>>e;
for(i=1;i<=e;i++)
{
cin>>u>>v;
g[u][v]=1;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
cout<<g[i][j]<<" ";
}
cout<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment