From e6417305858c2ebb3fcc0311924909166cd93950 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 12 Mar 2026 11:42:49 -0400 Subject: [PATCH] addresses MEC issue --- code/data_gen.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/code/data_gen.cpp b/code/data_gen.cpp index 0d00122..ac01242 100644 --- a/code/data_gen.cpp +++ b/code/data_gen.cpp @@ -8,7 +8,7 @@ //#include "json.hpp" using namespace std; //using json = nlohmann::json; -const int n = 5; +const int n = 4; const int nn = n*(n-1)/2; const int max_n = 8; //const int total_graph_number = ; @@ -361,7 +361,7 @@ namespace node_relations{ if (edges[node_stack[i+1]][node_stack[i]]==1) left_length+=1; else break; - for (int i = node_stack_pointer; i > 1; i++) + for (int i = node_stack_pointer; i > 1; i--) if (edges[node_stack[i-1]][node_stack[i]]==1) right_length+=1; else break; @@ -384,10 +384,11 @@ namespace node_relations{ for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (i != j) { - int new_x = order_list[i], new_y = order_list[j]; + // order list is for graph 2 + int old_x = order_list[i], old_y = order_list[j]; for (int k = 0; k < 7; k++) { - if ((graph_2.pair_relations[new_x][new_y]>>k)&1) - graph_1.pair_relation_count[i][j][k]++; + if ((graph_2.pair_relations[i][j]>>k)&1) + graph_1.pair_relation_count[old_x][old_y][k]++; } } } @@ -512,7 +513,7 @@ namespace json_output{ putchar('}');puts(""); } void jump_final_answer(){ - freopen("/Users/lvzhiheng/causal_relation_new_n=6.jsonl", "w", stdout); + freopen("/home/kevin/Desktop/corr2cause/data/causal_relation_new_n=4.jsonl", "w", stdout); for (int i = 1; i <= unique_DAG_num; i++){ jump_single_graph(uniqueDag[i]); }