From eff9b7e3ac6f894e03d644bfba564909a260794c Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Fri, 17 Mar 2017 21:00:23 +0100 Subject: Grafi --- Es 3.cpp | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Es 3.cpp (limited to 'Es 3.cpp') diff --git a/Es 3.cpp b/Es 3.cpp new file mode 100644 index 0000000..d525f62 --- /dev/null +++ b/Es 3.cpp @@ -0,0 +1,109 @@ +#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; +typedef pair p; +std::priority_queue, std::greater

> Q; +int V,E; +int matriceAdj[MAXN][MAXN]; +int T; +struct nodo { + vector adj; + int inizio,fine; +}no[MAXN]; + int colore[MAXN]; + bool Ciclico=false; + bool dfsVisit (int u) + { + cout<>V>>E; + int a,b; + for (int i=0;i>a>>b; + no[a].adj.push_back(b); + } + dfs(); + for (int i=0;i