porepy.utils.graph module

class Graph(node_connections)[source]

Bases: object

A graph class.

The graph class stores the nodes and edges of the graph in a sparse array (equivalently to face_nodes in the Grid class).

node_connections

Should be given at construction. node_node connections. Matrix size: num_nodes x num_nodes. node_connections[i,j] should be true if there is an edge connecting node i and j.

Type

sps.csc-matrix

regions

that can be reached by traversing the graph. Two nodes are int different regions if they can not be reached by traversing the graph.

Type

int

color

calling color_nodes() all nodes in a region are given the same colors and nodes in different regions are given different colors.

Type

int) the color of each region. Initialized as (NaN

bfs(start, color)[source]

Breadth first search

color_nodes()[source]

Color the nodes in each region