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

The function generates a network of objects and finds the neighbourhoods, calculates the composition of labels within the neighbourhoods, and clusters the neighbourhoods based on the label composition.

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

A measure of connectivity which evaluates the number of cycles in a graph in comparison with the maximum number of cycles.

centrality

Calculate centrality measures for a given network within a domain and optionally add the results as labels to objects.

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

A measure of connectivity that considers the relationship between the number of observed links and the number of possible links A value close to 0 indicates poor connectivity, with relatively few connections.

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.