From ba8e942d2a52a759aafd5451e66e6ae954132592 Mon Sep 17 00:00:00 2001 From: Ayushi C <67193440+AyushiChakrabarty@users.noreply.github.com> Date: Wed, 4 Nov 2020 11:21:46 +0530 Subject: [PATCH] Create Transitive Closure of a graph --- Transitive Closure of a graph | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Transitive Closure of a graph diff --git a/Transitive Closure of a graph b/Transitive Closure of a graph new file mode 100644 index 0000000..3dcfd76 --- /dev/null +++ b/Transitive Closure of a graph @@ -0,0 +1,61 @@ +#include +using namespace std; + + +int in_graph[6][6] = +{ + {0, 1, 0, 0, 0, 0}, + {0, 0, 0, 1, 0, 0}, + {0, 1, 0, 0, 0, 0}, + {1, 0, 1, 0, 1, 0}, + {0, 1, 0, 1, 0, 1}, + {1, 0, 0, 0, 0, 0} + +}; + + +void trans_c(int in_graph[6][6],int n) +{ + int N=n; + int out_graph[N][N]; + int i,j,k; + + for(i=0; i>n; + cout<<"The Transitive closure matrix is:\n"; + trans_c(in_graph,n); +