Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
meierlab.networks.graph.gen_basic_metrics#
- meierlab.networks.graph.gen_basic_metrics(G)[source]#
Assign some basic graph theory metrics to nodes in a graph.
- Parameters:
- G
networkx.Graph Graph to calculate metrics for.
- G
- Returns:
networkx.GraphGraph with ‘degree’, ‘betweenness’, and ‘eigenvector’ centrality attributes added to nodes.
Examples
>>> import networkx as nx >>> from meierlab.networks import graph >>> atlas = 'schaefer2018/atlas.csv' >>> sub_file = 'sub-001.tsv' >>> G = graph.gen_base_graph_from_atlas(atlas) >>> g = graph.gen_graph_from_matrix(G,atlas,sub_file) >>> g = graph.gen_basic_metrics(g) >>> eigenvectors = nx.get_node_attributes(g,'eigenvector') >>> print(eigenvectors['RH_Default_Temp_8']) 0.1889822365046136