Skip to content

CompareGraphs

CompareGraphs(in_graph1, weight, percentile, in_graph2, out_folder=’./comparison_results/’, verbose=False, overwrite=False, label_centroids=True, label_subjects=False, centroids_size=500, centroid_alpha=1, centroid_node_color=‘white’, centroid_edge_color=‘black’, subject_node_size=5, background_alpha=True, subject_edge_color=None, colormap=‘gray’, legend_title=‘Membership values’)

Graph Network Comparison

CompareGraphs is a script that compares 2 undirected weighted graph network. As of now, the only comparison implemented is the extraction of the Xth percentile nodes from –in-graph1 and label those nodes on –in-graph2. The percentile value is set by –percentile.

Graph Network Customization

To customize the graph appearance, please see the Network Visualization Options below. It should be noted that using subjects_labelling will crowd the network if it contains a high number of nodes. Also, centroids are labelled by default ‘c1, c2, …’ and subjects ‘s1, s2, …’.

Example Usage

CompareGraphs --in-graph1 graph1.gml --in-matrix membership_mat.npy
--percentile 80 --in-graph2 graph2.gml

Parameters

in_graph1 : 1st graph from which subjects above –percentile will be extracted and colored.

weight : Edge’s weight to use for the graph.

percentile : Percentile value used to extract subjects.

in_graph2 : 2nd graph to color extracted subjects on.

out_folder : Path of the folder in which the results will be written. If not specified, current folder and default name will be used.

verbose : If true, produce verbose output.

overwrite : If true, force overwriting of existing output files.

label_centroids : If true, centroids will be labelled.

label_subjects : If true, will label subjects nodes.

centroids_size : Size of the centroids nodes.

centroid_alpha : Alpha value representing the transparency of the centroids nodes.

centroid_node_color : Centroids nodes color to use.

centroid_edge_color : Assign a color to the edge of the centroids nodes.

subject_node_size : Assign the size of the subjects nodes.

background_alpha : If true, will plot the background nodes with alpha = 0.2.

subject_edge_color : Assign a color to the edge of the subjects nodes.

colormap : Colormap to use when coloring the edges of the network based on the membership values to each clusters. Available colormap are those from Matplotlib (https://matplotlib.org/stable/tutorials/colors/colormaps.html).

legend_title : Legend title (colormap).