network.utils
construct_attributes_dict(df, labels, id_column)
Section titled “construct_attributes_dict(df, labels, id_column)”Function to construct a dictionary of nodes’ attributes from a DataFrame.
Parameters
Section titled “Parameters”df : Pandas DataFrame containing nodes’ attributes.
labels : List of labels to add as nodes’ attributes.
id_column : Name of the column containing the subject’s ID tag.
Returns
Section titled “Returns”attributes_dict : Dictionary of nodes’ attributes.
extract_subject_percentile(mat, percentile)
Section titled “extract_subject_percentile(mat, percentile)”Function to extract subjects that are above the Xth percentile.
Parameters
Section titled “Parameters”mat : Fuzzy C-partitioned membership matrix.
percentile : Percentile value.
Returns
Section titled “Returns”label_dict : Dictionary of binary arrays for each clusters.
get_nodes_and_edges(df)
Section titled “get_nodes_and_edges(df)”Function to generate a dataframe containing edges’ data.
Parameters
Section titled “Parameters”df : Pandas DataFrame containing edges data and ids (membership matrix from clustering results).
Returns
Section titled “Returns”DataFrame : Pandas DataFrame of starting node, target node and edge weights.