about summary refs log tree commit diff
path: root/sourcecodes/execute_bn_gom.php
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/execute_bn_gom.php')
-rw-r--r--sourcecodes/execute_bn_gom.php34
1 files changed, 21 insertions, 13 deletions
diff --git a/sourcecodes/execute_bn_gom.php b/sourcecodes/execute_bn_gom.php
index 8a728a24..93d46309 100644
--- a/sourcecodes/execute_bn_gom.php
+++ b/sourcecodes/execute_bn_gom.php
@@ -48,15 +48,19 @@ $n=count($dataname);
 
 $initialstring="digraph G {\n"."size=\"6,8\";  ratio = fill;\n"."node [shape=square,width=1.5];\n";
 $endstring="}";
-fwrite($fout,"$initialstring");
+if ($fout !== false) {
+  fwrite($fout,"$initialstring");
+}
 
 $g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name_file=fopen($g_file_name,"w");
 
-for($i=0;$i<$n;$i++)
-{
-      $row_name=trim($dataname[$i]);  
-      fwrite($grviz_name_file,"$row_name\n");
+if ($grviz_name_file !== false) {
+  for($i=0;$i<$n;$i++)
+  {
+        $row_name=trim($dataname[$i]);
+        fwrite($grviz_name_file,"$row_name\n");
+  }
 }
 
 for($i=1;$i<=$n;$i++)
@@ -71,18 +75,22 @@ for($i=1;$i<=$n;$i++)
 	   {
                $col_val=trim($col_arr[$j]);
                if($col_val==1)
-               { 
+               {
                   $col_name=trim($dataname[$j]);
-                  fprintf($fout,"%s -> %s;\n",$ii,$j);  
+                  if ($fout !== false) {
+                    fprintf($fout,"%s -> %s;\n",$ii,$j);
+                  }
                   //fprintf($fouttemp,"%s -> %s;\n",$row_name,$col_name);
-                 
+
 	        }
           }
-          
-     
-} 
-fwrite($fout,"$endstring");   
-fclose($fout);
+
+
+}
+if ($fout !== false) {
+  fwrite($fout,"$endstring");
+  fclose($fout);
+}
 
 
 shell_exec('./run_scripts/run_octave '.$keyval);