API Reference

brainconn.centrality: Centrality

Metrics which identify the most important nodes in graphs.

brainconn.centrality Metrics which identify the most important nodes in graphs.
brainconn.centrality.betweenness_bin(G) Node betweenness centrality is the fraction of all shortest paths in the network that contain a given node.
brainconn.centrality.betweenness_wei(G) Node betweenness centrality is the fraction of all shortest paths in the network that contain a given node.
brainconn.centrality.diversity_coef_sign(W, ci) The Shannon entropy-based diversity coefficient measures the diversity of intermodular connections of individual nodes and ranges from 0 to 1.
brainconn.centrality.edge_betweenness_bin(G) Edge betweenness centrality is the fraction of all shortest paths in the network that contain a given edge.
brainconn.centrality.edge_betweenness_wei(G) Edge betweenness centrality is the fraction of all shortest paths in the network that contain a given edge.
brainconn.centrality.eigenvector_centrality_und(CIJ) Eigenector centrality is a self-referential measure of centrality: nodes have high eigenvector centrality if they connect to other nodes that have high eigenvector centrality.
brainconn.centrality.erange(CIJ) Shortcuts are central edges which significantly reduce the characteristic path length in the network.
brainconn.centrality.flow_coef_bd(CIJ) Computes the flow coefficient for each node and averaged over the network, as described in Honey et al.
brainconn.centrality.gateway_coef_sign(W, ci) The gateway coefficient is a variant of participation coefficient.
brainconn.centrality.kcoreness_centrality_bd(CIJ) The k-core is the largest subgraph comprising nodes of degree at least k.
brainconn.centrality.kcoreness_centrality_bu(CIJ) The k-core is the largest subgraph comprising nodes of degree at least k.
brainconn.centrality.module_degree_zscore(W, ci) The within-module degree z-score is a within-module version of degree centrality.
brainconn.centrality.pagerank_centrality(A, d) The PageRank centrality is a variant of eigenvector centrality.
brainconn.centrality.participation_coef(W, ci) Participation coefficient is a measure of diversity of intermodular connections of individual nodes.
brainconn.centrality.participation_coef_sign(W, ci) Participation coefficient is a measure of diversity of intermodular connections of individual nodes.
brainconn.centrality.subgraph_centrality(CIJ) The subgraph centrality of a node is a weighted sum of closed walks of different lengths in the network starting and ending at the node.

brainconn.clustering: Clustering

Metrics which group nodes within graphs into clusters.

brainconn.clustering Metrics which group nodes within graphs into clusters.
brainconn.clustering.agreement(ci[, buffsz]) Takes as input a set of vertex partitions CI of dimensions [vertex x partition].
brainconn.clustering.agreement_weighted(ci, wts) D = AGREEMENT_WEIGHTED(CI,WTS) is identical to AGREEMENT, with the exception that each partitions contribution is weighted according to the corresponding scalar value stored in the vector WTS.
brainconn.clustering.clustering_coef_bd(A) The clustering coefficient is the fraction of triangles around a node (equiv.
brainconn.clustering.clustering_coef_bu(G) The clustering coefficient is the fraction of triangles around a node (equiv.
brainconn.clustering.clustering_coef_wd(W) The weighted clustering coefficient is the average “intensity” of triangles around a node.
brainconn.clustering.clustering_coef_wu(W) The weighted clustering coefficient is the average “intensity” of triangles around a node.
brainconn.clustering.clustering_coef_wu_sign(W) Returns the weighted clustering coefficient generalized or separated for positive and negative weights.
brainconn.clustering.consensus_und(D, tau[, …]) This algorithm seeks a consensus partition of the agreement matrix D.
brainconn.clustering.get_components(A[, …]) Returns the components of an undirected graph specified by the binary and undirected adjacency matrix adj.
brainconn.clustering.get_components_old(A[, …]) Returns the components of an undirected graph specified by the binary and undirected adjacency matrix adj.
brainconn.clustering.number_of_components(A)
brainconn.clustering.transitivity_bd(A) Transitivity is the ratio of ‘triangles to triplets’ in the network.
brainconn.clustering.transitivity_bu(A) Transitivity is the ratio of ‘triangles to triplets’ in the network.
brainconn.clustering.transitivity_wd(W) Transitivity is the ratio of ‘triangles to triplets’ in the network.
brainconn.clustering.transitivity_wu(W) Transitivity is the ratio of ‘triangles to triplets’ in the network.

brainconn.core: Core

Metrics which identify the most important nodes in graphs.

brainconn.core Metrics which identify the most important nodes in graphs.
brainconn.core.assortativity_bin(CIJ[, flag]) The assortativity coefficient is a correlation coefficient between the degrees of all nodes on two opposite ends of a link.
brainconn.core.assortativity_wei(CIJ[, flag]) The assortativity coefficient is a correlation coefficient between the strengths (weighted degrees) of all nodes on two opposite ends of a link.
brainconn.core.core_periphery_dir(W[, gamma, C0]) The optimal core/periphery subdivision is a partition of the network into two nonoverlapping groups of nodes, a core group and a periphery group.
brainconn.core.kcore_bd(CIJ, k[, peel]) The k-core is the largest subnetwork comprising nodes of degree at least k.
brainconn.core.kcore_bu(CIJ, k[, peel]) The k-core is the largest subnetwork comprising nodes of degree at least k.
brainconn.core.local_assortativity_wu_sign(W) Local assortativity measures the extent to which nodes are connected to nodes of similar strength.
brainconn.core.rich_club_bd(CIJ[, klevel]) The rich club coefficient, R, at level k is the fraction of edges that connect nodes of degree k or higher out of the maximum number of edges that such nodes might share.
brainconn.core.rich_club_bu(CIJ[, klevel]) The rich club coefficient, R, at level k is the fraction of edges that connect nodes of degree k or higher out of the maximum number of edges that such nodes might share.
brainconn.core.rich_club_wd(CIJ[, klevel])
param CIJ:weighted directed connection matrix
brainconn.core.rich_club_wu(CIJ[, klevel])
param CIJ:weighted undirected connection matrix
brainconn.core.score_wu(CIJ, s) The s-core is the largest subnetwork comprising nodes of strength at least s.

brainconn.degree: Degree

Metrics which identify the most important nodes in graphs.

brainconn.degree Metrics which identify the most important nodes in graphs.
brainconn.degree.degrees_dir(CIJ) Node degree is the number of links connected to the node.
brainconn.degree.degrees_und(CIJ) Node degree is the number of links connected to the node.
brainconn.degree.jdegree(CIJ) This function returns a matrix in which the value of each element (u,v) corresponds to the number of nodes that have u outgoing connections and v incoming connections.
brainconn.degree.strengths_dir(CIJ) Node strength is the sum of weights of links connected to the node.
brainconn.degree.strengths_und(CIJ) Node strength is the sum of weights of links connected to the node.
brainconn.degree.strengths_und_sign(W) Node strength is the sum of weights of links connected to the node.

brainconn.distance: Distance

Metrics which identify the most important nodes in graphs.

brainconn.distance Metrics which identify the most important nodes in graphs.
brainconn.distance.breadthdist(CIJ) The binary reachability matrix describes reachability between all pairs of nodes.
brainconn.distance.breadth(CIJ, source) Implementation of breadth-first search.
brainconn.distance.charpath(D[, …]) The characteristic path length is the average shortest path length in the network.
brainconn.distance.cycprob(Pq) Cycles are paths which begin and end at the same node.
brainconn.distance.distance_bin(G) The distance matrix contains lengths of shortest paths between all pairs of nodes.
brainconn.distance.distance_wei(G) The distance matrix contains lengths of shortest paths between all pairs of nodes.
brainconn.distance.distance_wei_floyd(adjacency) Computes the topological length of the shortest possible path connecting every pair of nodes in the network.
brainconn.distance.retrieve_shortest_path(s, …) Returns nodes comprising shortest path between s and t
brainconn.distance.efficiency_bin(G[, local]) The global efficiency is the average of inverse shortest path length, and is inversely related to the characteristic path length.
brainconn.distance.efficiency_wei(Gw[, local]) The global efficiency is the average of inverse shortest path length, and is inversely related to the characteristic path length.
brainconn.distance.findpaths(CIJ, qmax, sources) Paths are sequences of linked nodes, that never visit a single node more than once.
brainconn.distance.findwalks(CIJ) Walks are sequences of linked nodes, that may visit a single node more than once.
brainconn.distance.mean_first_passage_time(…) Calculates mean first passage time of adjacency
brainconn.distance.reachdist(CIJ[, …]) The binary reachability matrix describes reachability between all pairs of nodes.
brainconn.distance.search_information(adjacency) Calculates search information of adjacency.

brainconn.generative: Generative

Metrics which identify the most important nodes in graphs.

brainconn.generative Metrics which identify the most important nodes in graphs.
brainconn.generative.generative_model(A, D, …) Generates synthetic networks using the models described in Betzel et al.
brainconn.generative.evaluate_generative_model(A, …) Generates synthetic networks with parameters provided and evaluates their energy function.

brainconn.modularity: Modularity

Metrics which identify the most important nodes in graphs.

brainconn.modularity Metrics which identify the most important nodes in graphs.
brainconn.modularity.ci2ls(ci) Convert from a community index vector to a 2D python list of modules The list is a pure python list, not requiring numpy.
brainconn.modularity.ls2ci(ls[, zeroindexed]) Convert from a 2D python list of modules to a community index vector.
brainconn.modularity.community_louvain(W[, …]) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes which maximizes the number of within-group edges and minimizes the number of between-group edges.
brainconn.modularity.link_communities(W[, …]) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes which maximizes the number of within-group edges and minimizes the number of between-group edges.
brainconn.modularity.modularity_dir(A[, …]) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_finetune_dir(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_finetune_und(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_finetune_und_sign(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_louvain_dir(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_louvain_und(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_louvain_und_sign(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_probtune_und_sign(W) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_und(A[, …]) The optimal community structure is a subdivision of the network into nonoverlapping groups of nodes in a way that maximizes the number of within-group edges, and minimizes the number of between-group edges.
brainconn.modularity.modularity_und_sign(W, ci) This function simply calculates the signed modularity for a given partition.
brainconn.modularity.partition_distance(cx, cy) This function quantifies the distance between pairs of community partitions with information theoretic measures.

brainconn.motifs: Motifs

Metrics which identify the most important nodes in graphs.

brainconn.motifs Metrics which identify the most important nodes in graphs.
brainconn.motifs.find_motif34(m[, n]) This function returns all motif isomorphs for a given motif id and class (3 or 4).
brainconn.motifs.make_motif34lib() This function generates the motif34lib.mat library required for all other motif computations.
brainconn.motifs.motif3funct_bin(A) Functional motifs are subsets of connection patterns embedded within anatomical motifs.
brainconn.motifs.motif3funct_wei(W) Functional motifs are subsets of connection patterns embedded within anatomical motifs.
brainconn.motifs.motif3struct_bin(A) Structural motifs are patterns of local connectivity.
brainconn.motifs.motif3struct_wei(W) Structural motifs are patterns of local connectivity.
brainconn.motifs.motif4funct_bin(A) Functional motifs are subsets of connection patterns embedded within anatomical motifs.
brainconn.motifs.motif4funct_wei(W) Functional motifs are subsets of connection patterns embedded within anatomical motifs.
brainconn.motifs.motif4struct_bin(A) Structural motifs are patterns of local connectivity.
brainconn.motifs.motif4struct_wei(W) Structural motifs are patterns of local connectivity.

brainconn.physical_connectivity: Physical connectivity

Metrics which identify the most important nodes in graphs.

brainconn.physical_connectivity Metrics which identify the most important nodes in graphs.
brainconn.physical_connectivity.density_dir(CIJ) Density is the fraction of present connections to possible connections.
brainconn.physical_connectivity.density_und(CIJ) Density is the fraction of present connections to possible connections.
brainconn.physical_connectivity.rentian_scaling(A, …) Physical Rentian scaling (or more simply Rentian scaling) is a property of systems that are cost-efficiently embedded into physical space.

brainconn.reference: Reference

Metrics which identify the most important nodes in graphs.

brainconn.reference Metrics which identify the most important nodes in graphs.
brainconn.reference.latmio_dir_connected(R, itr) This function “latticizes” a directed network, while preserving the in- and out-degree distributions.
brainconn.reference.latmio_dir(R, itr[, D]) This function “latticizes” a directed network, while preserving the in- and out-degree distributions.
brainconn.reference.latmio_und_connected(R, itr) This function “latticizes” an undirected network, while preserving the degree distribution.
brainconn.reference.latmio_und(R, itr[, D]) This function “latticizes” an undirected network, while preserving the degree distribution.
brainconn.reference.makeevenCIJ(n, k, sz_cl) This function generates a random, directed network with a specified number of fully connected modules linked together by evenly distributed remaining random connections.
brainconn.reference.makefractalCIJ(mx_lvl, …) This function generates a directed network with a hierarchical modular organization.
brainconn.reference.makerandCIJdegreesfixed(…) This function generates a directed random network with a specified in-degree and out-degree sequence.
brainconn.reference.makerandCIJ_dir(n, k) This function generates a directed random network
brainconn.reference.makerandCIJ_und(n, k) This function generates an undirected random network
brainconn.reference.makeringlatticeCIJ(n, k) This function generates a directed lattice network with toroidal boundary counditions (i.e.
brainconn.reference.maketoeplitzCIJ(n, k, s) This function generates a directed network with a Gaussian drop-off in edge density with increasing distance from the main diagonal.
brainconn.reference.null_model_dir_sign(W[, …]) This function randomizes an directed network with positive and negative weights, while preserving the degree and strength distributions.
brainconn.reference.null_model_und_sign(W[, …]) This function randomizes an undirected network with positive and negative weights, while preserving the degree and strength distributions.
brainconn.reference.randmio_dir(R, itr) This function randomizes a directed network, while preserving the in- and out-degree distributions.
brainconn.reference.randmio_dir_connected(R, itr) This function randomizes a directed network, while preserving the in- and out-degree distributions.
brainconn.reference.randmio_dir_signed(R, itr) This function randomizes a directed weighted network with positively and negatively signed connections, while preserving the positive and negative degree distributions.
brainconn.reference.randmio_und(R, itr) This function randomizes an undirected network, while preserving the degree distribution.
brainconn.reference.randmio_und_connected(R, itr) This function randomizes an undirected network, while preserving the degree distribution.
brainconn.reference.randmio_und_signed(R, itr) This function randomizes an undirected weighted network with positive and negative weights, while simultaneously preserving the degree distribution of positive and negative weights.
brainconn.reference.randomize_graph_partial_und(A, …) A = RANDOMIZE_GRAPH_PARTIAL_UND(A,B,MAXSWAP) takes adjacency matrices A and B and attempts to randomize matrix A by performing MAXSWAP rewirings.
brainconn.reference.randomizer_bin_und(R, alpha) This function randomizes a binary undirected network, while preserving the degree distribution.

brainconn.similarity: Similarity

Metrics which identify the most important nodes in graphs.

brainconn.similarity Metrics which identify the most important nodes in graphs.
brainconn.similarity.corr_flat_dir(a1, a2) Returns the correlation coefficient between two flattened adjacency matrices.
brainconn.similarity.corr_flat_und(a1, a2) Returns the correlation coefficient between two flattened adjacency matrices.
brainconn.similarity.dice_pairwise_und(a1, a2) Calculates pairwise dice similarity for each vertex between two matrices.
brainconn.similarity.edge_nei_overlap_bd(CIJ) This function determines the neighbors of two nodes that are linked by an edge, and then computes their overlap.
brainconn.similarity.edge_nei_overlap_bu(CIJ) This function determines the neighbors of two nodes that are linked by an edge, and then computes their overlap.
brainconn.similarity.gtom(adj, nr_steps) The m-th step generalized topological overlap measure (GTOM) quantifies the extent to which a pair of nodes have similar m-th step neighbors.
brainconn.similarity.matching_ind(CIJ) For any two nodes u and v, the matching index computes the amount of overlap in the connection patterns of u and v.
brainconn.similarity.matching_ind_und(CIJ0) M0 = MATCHING_IND_UND(CIJ) computes matching index for undirected graph specified by adjacency matrix CIJ.

brainconn.nbs: Network-based statistic

Network-based statistic calculation.

brainconn.nbs Network-based statistic calculation.
brainconn.nbs.nbs_bct(x, y, thresh[, k, …]) Performs the NBS for populations X and Y for a t-statistic threshold of alpha.

brainconn.utils: Utility functions

Utility functions.

brainconn.utils Utility functions.
brainconn.utils.matrix Other utility functions.
brainconn.utils.visualization Tools for visualizing graphs.
brainconn.utils.misc Miscellaneous utility functions.