|
1234567891011121314151617181920 |
- function [data] = BuildFacebookData(graph)
-
- graph_size = size(graph,2);
- all_nodes = zeros(1,graph_size);
- for i = 1:graph_size
- all_nodes(1,i) = graph{i}(1);
- end
-
- data = sparse(graph_size, graph_size); %TODO change to graph size
- for i = 1:graph_size
- node_idx = find(all_nodes == graph{i}(1));
- for j = 2:size(graph{i},2)
- neighbor_idx = find(all_nodes == graph{i}(j));
- if size(neighbor_idx,2) > 0
- data(node_idx, neighbor_idx) = 1;
- data(neighbor_idx,node_idx) = 1;
- end
- end
- end
- end
|