You are on page 1of 1

#include<bits/stdc++.

h>
using namespace std;
vector<int > v1[100];
main()
{
int v,e,i,j;
cout<<"enter no o edges and vertices\n";
cin>>v>>e;
int ch;
cout<<"enter directed o rundirectd\\n";

//int mat[e][2];
int x,y;
cin>>ch;
for(i=0;i<e;i++)
{
cin>>x>>y;
v1[x].push_back(y);
if(ch==1)v1[y].push_back(x);
}
for(i=1;i<=v;i++)
{
cout<<i<<" ";
for(j=0;j<v1[i].size();j++)
{
if(j==v1[i].size()-1)
cout<<v1[i][j]<<"\n";
else
cout<<v1[i][j]<<"--> ";
}
cout<<"\n";
}
set<int> s;
s.insert(10);
cout<<s.size();

You might also like