summaryrefslogtreecommitdiff
path: root/37/CH8
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:38:01 +0530
committerprashantsinalkar2017-10-10 12:38:01 +0530
commitf35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch)
treeeb72842d800ac1233e9d890e020eac5fd41b0b1b /37/CH8
parent7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff)
downloadScilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2
Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip
updated the code
Diffstat (limited to '37/CH8')
-rwxr-xr-x37/CH8/EX8.5/s5.sci58
1 files changed, 29 insertions, 29 deletions
diff --git a/37/CH8/EX8.5/s5.sci b/37/CH8/EX8.5/s5.sci
index 04714a975..668d8e6a0 100755
--- a/37/CH8/EX8.5/s5.sci
+++ b/37/CH8/EX8.5/s5.sci
@@ -1,29 +1,29 @@
-//Warshall's Algorithm
-funcprot(0)
-function[path]=transclose(adj,n)
- for i=1:n
- for j=1:n
- path((i-1)*n+j)=adj((i-1)*n+j);
- end
- end
- for k=1:n
- for i=1:n
- if(path((i-1)*n+k)==1)
- for j=1:n
- path((i-1)*n+j)=path((i-1)*n+j)|path((k-1)*n+j);
- end
- end
- end
- end
- printf("Transitive closure for the given graph is:\n");
- for i=1:n
- printf("For vertex %d \n",i);
- for j=1:n
- printf("%d %d is %d\n",i,j,path((i-1)*n+j));
- end
- end
-endfunction
-//Calling Routine:
-n=3;
-adj=[0 1 0 0 0 1 0 0 0]
-path=Tranclose(adj,n) \ No newline at end of file
+//Warshall's Algorithm
+funcprot(0)
+function[path]=transclose(adj,n)
+ for i=1:n
+ for j=1:n
+ path((i-1)*n+j)=adj((i-1)*n+j);
+ end
+ end
+ for k=1:n
+ for i=1:n
+ if(path((i-1)*n+k)==1)
+ for j=1:n
+ path((i-1)*n+j)=path((i-1)*n+j)|path((k-1)*n+j);
+ end
+ end
+ end
+ end
+ printf("Transitive closure for the given graph is:\n");
+ for i=1:n
+ printf("For vertex %d \n",i);
+ for j=1:n
+ printf("%d %d is %d\n",i,j,path((i-1)*n+j));
+ end
+ end
+endfunction
+//Calling Routine:
+n=3;
+adj=[0 1 0 0 0 1 0 0 0]
+path=transclose(adj,n) \ No newline at end of file