From eff9b7e3ac6f894e03d644bfba564909a260794c Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 17 Mar 2017 21:00:23 +0100 Subject: Grafi --- DFS.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 DFS.cpp (limited to 'DFS.cpp') diff --git a/DFS.cpp b/DFS.cpp new file mode 100644 index 0000000..fda5a33 --- /dev/null +++ b/DFS.cpp @@ -0,0 +1,39 @@ +#include +#define BIANCO 0 //Non Visitato +#define NERO 2 //Visitato +#define GRIGIO 1 //Non Finito +#define INF 999999 +#include +#include +#include +#define MAXN 9999 +#define INDEF -1 +#include +using namespace std; +int V=9; +int matriceAdj[MAXN][MAXN]; + int colore[MAXN]; + //DFS Tramite matrice di adiacenza + void dfsVisit (int u) + { + colore[u]= GRIGIO; + for (int i=0;i