muspan.networks#

The muspan.networks module provides tools for working with networks in the MuSpAn package. This module includes the following submodules:

Network generation and manipulation

generate_network

Generate network using the domain objects.

add_similarity_weight_to_edges

Adds edge weight to all connected nodes that is valued as a similarity of node features.

add_dissimilarity_weight_to_edges

Adds edge weight to all connected nodes that is valued as a dissimilarity of node features.

Neighbourhood analysis methods

cluster_neighbourhoods

A function to cluster neighbourhoods based on the enrichment of labels within the neighbourhoods of objects using a network connectivity.

khop_neighbourhood

For a given network, find the k-hop neighbourhood of a set of source objects.

knn_label_count

Counts the number of each label within proximity of a source object using KNN networks.

Network-based point pattern analysis

adjacency_permutation_test

Test the correlation between adjacency labels in a network, also referred to as neighbourhood enrichment.

Network metrics

alpha_index

Calculate the alpha index of a network.

betweenness_centrality

Computes the betweenness centrality of each node using the networkx implementation.

closeness_centrality

Computes the closeness centrality of each node using the networkx implementation.

compactness

Provides an index [0,1] of how compact the network is in terms of its area and length of edges.

cyclomatic_number

Calculate the cyclomatic number of a network.

edge_orientation_distribution

Computes the symmetric distribution of edge orientations for a network.

gamma_index

The gamma index is a simple measure of the density of the network.

katz_centrality

Computes the Katz centrality of each node using the networkx implementation.

laplacian_centrality

Computes the laplacian centrality of each node.

node_degree

Computes the degree for each node.

Network clustering

community_detection

Community detection on a provided network.

Network comparison methods

network_distance

Calculate the distance between two networks providing a quantitative measure of the similarity between them.