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.

bond_percolation(ij, occupied_bonds)

Calculates the site and bond occupancy status for 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[, ...])

Returns the possible connections between two groups of pores, and optionally makes the connections.

conns_to_am(conns[, shape, force_triu, ...])

Converts a list of connections into a Scipy sparse adjacency matrix

dimensionality([network, coords])

Checks the dimensionality of the network

drop_sites(am, sites)

Update adjacency matrix after dropping sites

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])

Find pores with a given number of neighbors

find_clusters(network[, mask, t_labels])

Identify connected clusters of pores in the network.

find_complement(am[, sites, bonds, asmask])

Finds the complementary sites (or bonds) to a given set of inputs

find_connected_sites(bonds, am[, flatten, logic])

Given an adjacency matrix, finds which sites are connected to the input bonds.

find_connecting_bonds(sites, am)

Given pairs of sites, finds the bonds which connects each pair.

find_neighbor_bonds(sites[, im, am, ...])

Given an incidence matrix, finds all sites that are connected to the input sites.

find_neighbor_sites(sites, am[, flatten, ...])

Given a symmetric adjacency matrix, finds all sites that are connected to the input sites.

find_path(network, pore_pairs[, weights])

Find the shortest path between pairs of pores.

find_pore_to_pore_distance(network[, ...])

Find the distance between all pores on set 1 to each pore in set 2

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.

from_cylindrical(r, theta, z)

from_spherical(r, theta, phi)

generate_base_points(num_points, domain_size)

Generates a set of base points for passing into the Tessellation-based Network classes.

generate_voxel_image(network[, pore_shape, ...])

Generate a voxel image from an GenericNetwork

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 the shape of each axis of a simple cubic network


Determine the spacing along each axis of a simple 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

isoutside(coords, shape)

Identifies points that lie outside the specified shape

ispercolating(am, inlets, outlets[, mode])

Determines if a percolating clusters exists in the network spanning the given inlet and outlet sites


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 is the sparse adjacency matrix is lower triangular


Returns True is 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

merge_pores(network, pores[, labels])

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

plot_connections(network[, throats, ax, ...])

Produce a 3D plot of the network topology.

plot_coordinates(network[, pores, ax, ...])

Produce a 3D plot showing specified pore coordinates as markers.

plot_network_jupyter(network[, node_color, ...])

Visualize a network in 3D using Plotly.

plot_networkx(network[, plot_throats, ...])

Creates a pretty 2d plot for 2d OpenPNM networks.

plot_tutorial(network[, font_size, ...])

Generate a network plot suitable for tutorials and explanations.

plot_vpython(network[, Psize, Tsize, ...])

Quickly visualize a network in 3D using VPython.

reflect_base_points(base_pts, domain_size)

Helper function for relecting a set of points about the faces of a given domain.

remove_isolated_clusters(labels, inlets)

Finds cluster labels not attached to the inlets, and sets them to unoccupied (-1)

rotate_coords(network[, a, b, c, R])

Rotates coordinates a given amount about each axis

shear_coords(network[, ay, az, bx, bz, cx, ...])

Shears the coordinates a given amount about along axis

site_percolation(ij, occupied_sites)

Calculates the site and bond occupancy status for 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.

stitch_pores(network, pores1, pores2[, mode])

Stitches together pores in a network with disconnected clusters

subdivide(network, pores, shape[, labels])

It trim the pores and replace them by cubic networks with the sent shape.

template_cylinder_annulus(height, outer_radius)

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

template_sphere_shell(outer_radius[, ...])

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

to_cylindrical(X, Y, Z)

to_spherical(X, Y, Z)


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

trim_occluded_throats(network[, mask])

Remove throats with zero area from the network and also remove pores that are isolated as a result


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