function [ data, indices_to_remove ] = DecreaseGraphSize( data, missing_nodes_mapping, nodes_not_to_remove )
%DecreaseGraphSize Remove nodes that are not missing nodes or neighbors of
%missing nodes
%   Expects the original data

nodes_to_keep = zeros(1, size(data,1));

missing_nodes = missing_nodes_mapping(1,:);

for curr_missing_node = missing_nodes
    
    nodes_to_keep(curr_missing_node) = 1;
    nodes_to_keep = nodes_to_keep | data(curr_missing_node,:);
        
end

nodes_to_keep(nodes_not_to_remove) = 1;

nodes_to_remove = ~nodes_to_keep;

indices_to_remove = find(nodes_to_remove);

data(indices_to_remove,:) = [];
data(:, indices_to_remove) = [];


end

