import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import scipy.io as sp
import os

path = 'output\mine'
missing_node_count = 2
mae_list = list()
for filename in os.listdir(path):
    adj_matrix_orig = sp.loadmat(path + '\\' + filename)['remapped_data'].A
    adj_matrix_p = sp.loadmat(path + '\\' + filename)['out_data'].A
    mae = np.sum(abs(adj_matrix_orig - adj_matrix_p))
    mae = mae / (adj_matrix_p.shape[0] * 2 * missing_node_count)
    mae_list.append(mae)

print(np.mean(mae_list))
