Skip to content

network.utils

construct_attributes_dict(df, labels, id_column)

Function to construct a dictionary of nodes’ attributes from a DataFrame.

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

attributes_dict : Dictionary of nodes’ attributes.

extract_subject_percentile(mat, percentile)

Function to extract subjects that are above the Xth percentile.

Parameters

mat : Fuzzy C-partitioned membership matrix.

percentile : Percentile value.

Returns

label_dict : Dictionary of binary arrays for each clusters.

get_nodes_and_edges(df)

Function to generate a dataframe containing edges’ data.

Parameters

df : Pandas DataFrame containing edges data and ids (membership matrix from clustering results).

Returns

DataFrame : Pandas DataFrame of starting node, target node and edge weights.