dolfinx.graph

Graph representations and operations on graphs.

Functions

adjacencylist(data[, offsets])

Create an AdjacencyList for int32 or int64 datasets.

Classes

AdjacencyList(cpp_object)

Creates a Python wrapper for the exported adjacency list class.

class dolfinx.graph.AdjacencyList(cpp_object: _cpp.la.AdjacencyList_int32 | _cpp.la.AdjacencyList_int64)[source]

Bases: object

Creates a Python wrapper for the exported adjacency list class.

Note

Do not use this constructor directly. Instead use adjacencylist().

Parameters:

wrap. (The underlying cpp instance that this object will)

property array: ndarray[Any, dtype[int32 | int64]]

Array representation of the adjacency list.

Returns:

Flattened array representation of the adjacency list.

Retrieve the links of a node.

Parameters:

of. (Node to retrieve the connectitivty)

Returns:

Neighbors of the node.

property num_nodes: int32

Number of nodes in the adjacency list.

Returns:

Number of nodes.

property offsets: ndarray[Any, dtype[int32]]

Offsets for each node in the array().

Returns:

Array of indices with shape (num_nodes+1).

dolfinx.graph.adjacencylist(data: ndarray[Any, dtype[int32 | int64]], offsets: ndarray[Any, dtype[int32]] | None = None) AdjacencyList[source]

Create an AdjacencyList for int32 or int64 datasets.

Parameters:
  • data – The adjacency array. If the array is one-dimensional, offsets should be supplied. If the array is two-dimensional the number of edges per node is the second dimension.

  • offsets – The offsets array with the number of edges per node.

Returns:

An adjacency list.