Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions code/data_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ;
Expand Down Expand Up @@ -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;

Expand All @@ -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]++;
}
}
}
Expand Down Expand Up @@ -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]);
}
Expand Down