You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DecreaseGraphSize.m 698B

5 years ago
12345678910111213141516171819202122232425262728
  1. function [ data, indices_to_remove ] = DecreaseGraphSize( data, missing_nodes_mapping, nodes_not_to_remove )
  2. %DecreaseGraphSize Remove nodes that are not missing nodes or neighbors of
  3. %missing nodes
  4. % Expects the original data
  5. nodes_to_keep = zeros(1, size(data,1));
  6. missing_nodes = missing_nodes_mapping(1,:);
  7. for curr_missing_node = missing_nodes
  8. nodes_to_keep(curr_missing_node) = 1;
  9. nodes_to_keep = nodes_to_keep | data(curr_missing_node,:);
  10. end
  11. nodes_to_keep(nodes_not_to_remove) = 1;
  12. nodes_to_remove = ~nodes_to_keep;
  13. indices_to_remove = find(nodes_to_remove);
  14. data(indices_to_remove,:) = [];
  15. data(:, indices_to_remove) = [];
  16. end