% Read the CSV file data = readtable('../MGREL.RRF', Delimiter='|', FileType='text', NumHeaderLines=0, VariableNamingRule='preserve'); data = renamevars(data,"#CUI1","CUI1"); ids_1 = data.CUI1; for k = 1 : length(ids_1) cellContents = ids_1{k}; % Truncate and stick back into the cell ids_1{k} = cellContents(2:end); end ids_1 = str2double(ids_1); ids_2 = data.CUI2; for k = 1 : length(ids_2) cellContents = ids_2{k}; % Truncate and stick back into the cell ids_2{k} = cellContents(2:end); end ids_2 = str2double(ids_2); % Get the number of unique nodes %nodes = unique([ids_1; ids_2]); %num_nodes = length(nodes); % Initialize sparse adjacency matrix %A = sparse(ids_1, ids_2, 1, max(ids_2), max(ids_2)); % Display adjacency matrix %disp(A); %G = digraph(A); G = digraph(ids_1, ids_2); [bin,binsize] = conncomp(G,'Type','weak'); bin(1:10) max(binsize) pg_ranks = centrality(G,'pagerank'); G.Nodes.PageRank = pg_ranks; %hub_ranks = centrality(G,'hubs'); %auth_ranks = centrality(G,'authorities'); %G.Nodes.Hubs = hub_ranks; %G.Nodes.Authorities = auth_ranks; G.Nodes %plot(G);