%{
*********************************************************** 
(c) Ian Davidson and Davidson Lab. Please cite 

The Cluster Description Problem-Complexity Results, Formulations and Approximati
ons, I Davidson, A Gourru and SS. Ravi
Advances in Neural Information Processing Systems, 2018, 6191-6201
***********************************************************
%}

clc;clear;

%% usa-880 data
% T = load('StructuralUserHashtagIUR.csv'); % Says what users used what hashtags its n x t
% T(T > 1) = 1;
% nodeNames = importdata('nodesUserIUR.csv'); % Names of users n x str
% c = load('Comm1Indicies.csv') + 1;
% hashtags = readtable('nodesHashtagUSA.csv');
% tagNames = table2array(hashtags);

%% usa-10k data
% T = load('StructuralUserHashtagUSA.csv'); % Says what users used what hashtags its n x t
% T(T > 1) = 1;
% nodeNames = importdata('nodesUSA.csv'); % Names of users n x str
% c = csvread('comUSA.csv', 1, 2);
% hashtags = readtable('nodesHashtagUSA.csv');
% tagNames = table2array(hashtags);

%% France-10k data
T = load('StructuralHashtagsFrance.csv'); % Says what users used what hashtags its n x t
T(T > 1) = 1;
nodeNames = importdata('nodesFrance.csv'); 
nodeNames = nodeNames.textdata; % Names of users n x str
c = csvread('comFrance.csv', 1, 2);
hashtags = readtable('nodesHashtagsFrance.csv');
tagNames = table2array(hashtags);
%% usa-by month data
% T = load('ByMounths/actUSAMounth1.csv'); % Says what users used what hashtags its n x t
% T(T > 1) = 1;
% nodeNames = importdata('nodesUSA.csv'); % Names of users n x str
% c = csvread('comUSA.csv', 1, 2);
% hashtags = readtable('nodesHashtagUSA.csv');
% tagNames = table2array(hashtags);

%% france-by month data
% T = load('ByMounths/actFranceMounth4.csv'); % Says what users used what hashtags its n x t
% T(T > 1) = 1;
% nodeNames = importdata('nodesFrance.csv'); % Names of users n x str
% nodeNames = nodeNames.textdata;
% c = csvread('comFrance.csv', 1, 2);
% hashtags = readtable('nodesHashtagsFrance.csv');
% tagNames = table2array(hashtags);
%%

idx_delete = ~any(T, 2);
T(idx_delete, :) = [];
c(idx_delete, :) = [];
nodeNames(idx_delete, :) = [];
[n, t] = size(T);

x = cover_or_forget_func(T, c, 3 * ones(t, 1), 100);
% the ones matrix ensures completely disjoint
explanations. To relax this (and allow w_i to be > 1 (see paper)) increase these
 entries


if ~isempty(x)
    disp_tags_forgotten_nodes(x, tagNames, nodeNames, max(c(:)))
end

