jkunlin vor 8 Jahren
Ursprung
Commit
b3a133b4a5
4 geänderte Dateien mit 95 neuen und 1 gelöschten Zeilen
  1. 2 0
      .gitignore
  2. 32 0
      arch_tool/prun.sh
  3. 60 0
      arch_tool/stat.cc
  4. 1 1
      stat/filename.sh

+ 2 - 0
.gitignore

@@ -2,3 +2,5 @@ dimacs2txt
 dimacs2metis
 test_dimacs
 subgraph
+latex_table
+win

+ 32 - 0
arch_tool/prun.sh

@@ -0,0 +1,32 @@
+# !/bin/bash
+
+instance_dirs="bio col fb inf int rec ret sci soc tec web quasiRegular heavyTail snap"
+
+all_results_dir="./all_satur_color_gc_arch"
+graph_dir="./all_satur_color_gc"
+
+if [ ! -d "$all_results_dir" ]
+then
+	mkdir "$all_results_dir"
+fi
+
+for ins_dir in $instance_dirs
+do
+	echo "$ins_dir"
+	res_dir="$all_results_dir"/"$ins_dir"
+	if [ ! -d "$res_dir" ]
+	then
+		mkdir "$res_dir"
+	fi
+	find  "$graph_dir/$ins_dir" -maxdepth 1 -mindepth 1 |
+	while read instance
+	do
+		instance=$(basename "$instance")
+		res_file="$res_dir"/"$instance"
+		res_file=${res_file%%_seed*}
+		./stat "$graph_dir/$ins_dir/$instance"  >> "$res_file"
+	done
+done
+
+
+exit 0

+ 60 - 0
arch_tool/stat.cc

@@ -0,0 +1,60 @@
+// =====================================================================================
+//
+//       Filename:  stat.cc
+//
+//    Description:  read one result
+//
+//        Version:  1.0
+//        Created:  2018年 03月 16日 星期五 22:02:12 CST
+//       Revision:  none
+//       Compiler:  g++
+//
+//         Author:  Jinkun Lin, jkunlin@gmail.com
+//   Organization:  School of EECS, Peking University
+//
+// =====================================================================================
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+using namespace std;
+
+int main(int argc, char const *argv[]) {
+	if (argc != 2) {
+		return 1;
+	}
+	string filename = argv[1];
+	ifstream infile(filename);
+	if (!infile) {
+		std::cout << "file" << std::endl;
+		return 1;
+	}
+
+	size_t b = filename.find_last_of('_') + 5;
+	size_t e = filename.find_last_of('.');
+	string seed = filename.substr(b, e - b);
+
+	double cutoff = 120;
+
+	string line, tmp;
+	int size, old_size = 0;
+	double time, old_time = 0;
+	char exact = 'h';
+
+	while (getline(infile, line)) {
+		istringstream is(line);
+		is >> tmp >> size >> time;
+		if (time > cutoff) {
+			size = old_size;
+			time = old_time;
+		}
+		else {
+			old_size = size;
+			old_time = time;
+		}
+	}
+
+	std::cout << seed << '\t' << size << '\t' <<  time << '\t' << exact << std::endl;
+
+	return 0;
+}

+ 1 - 1
stat/filename.sh

@@ -3,7 +3,7 @@
 # bio col fb inf int rec ret sci soc tec web
 #~/massive-graphs/${dir}/focus/*.dim; do
 
-SOURCE_DIR="./fastwclq/63e68_ran/63e68_1_1"
+SOURCE_DIR="./all_satur_color_gc_arch"
 
 find "$SOURCE_DIR" -maxdepth 1 -mindepth 1| while read dir
 do