Cod sursa(job #2388780)
| Utilizator | Data | 26 martie 2019 13:51:03 | |
|---|---|---|---|
| Problema | Parcurgere DFS - componente conexe | Scor | 0 |
| Compilator | cpp-32 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
vector < vector <int> > G;
int N,M,i,x,y,viz[100001];
void DFS(int nod)
{
int i;
for(i=0;i<N;i++)
{
if(viz[v[i]]==0)
{
DFS(v[i]);
}
}
}
int main()
{
ifstream fin("dfs.in");
ofstream fout("dfs.out");
fin>>N>>M;
for(i=1;i<=M;i++)
{
fin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
fin.close();
fout.close();
return 0;
}
