Collection of functions for manipulating network topology#

This module contains a selection of functions that deal specifically with network topology.


add_boundary_pores(network, pores[, offset, ...])

This method uses clone_pores to clone the input pores, then shifts them the specified amount and direction, then applies the given label.

add_reservoir_pore(cls, network, pores[, offset])

Adds a single pore connected to all pores to act as a reservoir

bond_percolation(network, occupied_bonds)

Assigns cluster numbers to sites and bonds acccording to a bond percolation process, given a list of occupied bonds.

clone_pores(network, pores[, labels, mode])

Clones the specified pores and adds them to the network

connect_pores(network, pores1, pores2[, labels])

Returns the possible connections between two groups of pores

conns_to_am(*args, **kwargs)

Converts a list of connections into a Scipy sparse adjacency matrix


Determines whether a network is 1D, 2D or 3D, and in which dimensions

drop_sites(am, sites)

Update adjacency matrix after dropping nodes

extend(network[, coords, conns, labels])

Add pores or throats to the network from a list of coords or conns.

filter_pores_by_z(network, pores, z)

Filters a list of nodes to those with a given number of neighbors

find_clusters(network[, mask])

Identify connected clusters of pores and throats in the network.

find_connected_sites(bonds, **kwargs)

Finds which nodes are connected to a given set of edges

find_connecting_bonds(sites, **kwargs)

Finds the edge that connects each pair of given nodes

find_interface_throats(network, P1, P2)

Finds edges shared between two sets of nodes

find_isolated_clusters(network, mask, inlets)

Identifies pores and throats that are invaded but not connected to the inlets

find_neighbor_bonds(sites, **kwargs)

Finds all edges that are connected to the given input nodes

find_neighbor_sites(sites, **kwargs)

Finds all nodes that are directly connected to the input nodes

find_path(network, pore_pairs[, weights])

Find the shortest path between pairs of nodes

find_surface_pores(network[, markers, label])

Find the pores on the surface of the domain by performing a Delaunay triangulation between the network pores and some external markers.

generate_base_points(num_points, domain_size)

Generates a set of randomly distributed points in rectilinear coordinates for use in spatial tessellations

get_domain_area(network[, inlets, outlets])

Determine the cross sectional area relative to the inlets/outlets.

get_domain_length(network[, inlets, outlets])

Determine the domain length relative to the inlets/outlets.


Determine shape of a cubic network


Determine spacing of a cubic network


Computes centroid of the convex hull enclosing the given coordinates.

is_fully_connected(network[, pores_BC])

Checks whether network is fully connected, i.e. not clustered.


Determines if given pores are coplanar with each other


Identifies sites that lie outside the specified shape

ispercolating(network, inlets, outlets)

Determines if a percolating cluster exists in the network spanning the given inlet and outlet nodes


A method to check if a square matrix is symmetric Returns True if the sparse adjacency matrix is symmetric


Returns True if the sparse adjacency matrix is either upper or lower triangular


Returns True if the sparse adjacency matrix is lower triangular


Returns True if the sparse adjacency matrix is upper triangular

label_faces(network[, tol, label])

Finds pores on the surface of the network and labels them according to whether they are on the top, bottom, etc.

merge_networks(network[, donor])

Combine multiple networks into one without making any topological connections

merge_pores(network, pores[, labels, ...])

Combines a selection of pores into a new single pore located at the centroid of the selected pores (and optionally their neighbors) and connected to all of their neighbors.

reduce_coordination(network, z)

Deletes throats on network to match specified average coordination number

reflect_base_points(points, domain_size)

Relects a set of points about the faces of a given domain

rotate_coords(network, **kwargs)

Rotates coordinates a given amount about each axis

shear_coords(network, **kwargs)

Shears the coordinates a given amount about along axis

site_percolation(network, occupied_sites)

Assigns cluster numbers to sites and bonds acccording to a site percolation process, given a list of occupied sites.

stitch(network, donor, P_network, P_donor[, ...])

Stitches a second a network to the current network.

template_cylinder_annulus(z, r_outer[, r_inner])

This method generates an image array of a disc-ring.

template_sphere_shell(r_outer[, r_inner])

This method generates an image array of a sphere-shell.


Given a Delaunay triangulation object from Scipy's spatial module, converts to a sparse adjacency matrix network representation.

trim(network[, pores, throats])

Remove pores or throats from the network


Computes actual node and edge occupancy based on connectivity to the given inlets


Given a Voronoi tessellation object from Scipy's spatial module, converts to a sparse adjacency matrix network representation in COO format.