graphlow.util package

Submodules

graphlow.util.array_handler module

graphlow.util.array_handler.convert_to_dense_numpy(array)[source]

Convert input array to numpy array. If input is sparse, converted to dense.

Parameters:

array (graphlow.util.typing.ArrayDataType)

Return type:

numpy.ndarray

graphlow.util.array_handler.convert_to_numpy_scipy(array)[source]

Convert input array to numpy array or scipy sparse array.

Parameters:

array (graphlow.util.typing.ArrayDataType)

Return type:

numpy.ndarray | sp.sparray

graphlow.util.array_handler.convert_to_scipy_sparse_csr(array)[source]

Convert input array to scipy CSR array.

Parameters:

array (graphlow.util.typing.ArrayDataType)

Return type:

scipy.sparse.csr_array

graphlow.util.array_handler.convert_to_torch_sparse_csr(array, *, device=None, dtype=None)[source]

Convert input array to torch CSR tensor.

Parameters:
  • array (graphlow.util.typing.ArrayDataType)

  • device (torch.device | None)

  • dtype (torch.dtype | None) – Data type of the converted tensor. Note that it is effective only when tensor is float-like, i.e., bool or int will be preserved.

Return type:

torch.Tensor

graphlow.util.array_handler.convert_to_torch_tensor(array, *, device=None, dtype=None)[source]

Convert input array to torch tensor. If the input is sparse, output tensor will be also sparse.

Parameters:
  • array (graphlow.util.typing.ArrayDataType)

  • device (torch.device | None)

  • dtype (torch.dtype | None) – Data type of the converted tensor. Note that it is effective only when tensor is float-like, i.e., bool or int will be preserved.

Return type:

torch.Tensor

graphlow.util.array_handler.convert_to_valid_dtype_for_vtk(dtype)[source]
Parameters:

dtype (dtype)

Return type:

dtype

graphlow.util.constants module

graphlow.util.enums module

class graphlow.util.enums.Extension(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

STL = 'stl'
VTK = 'vtk'
VTM = 'vtm'
VTP = 'vtp'
VTU = 'vtu'
class graphlow.util.enums.FeatureName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

ORIGINAL_INDEX = 'original_index'
POINTS = 'points'
TIME_VALUE = 'TimeValue'
class graphlow.util.enums.SparseMatrixName(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

CELL_ADJACENCY = 'cell_adjacency'
CELL_DEGREE = 'cell_degree'
CELL_POINT_INCIDENCE = 'cell_point_incidence'
FACET_CELL_INCIDENCE = 'facet_cell_incidence'
NORMALIZED_CELL_ADJ = 'normalized_cell_adj'
NORMALIZED_POINT_ADJ = 'normalized_point_adj'
POINT_ADJACENCY = 'point_adjacency'
POINT_DEGREE = 'point_degree'

graphlow.util.logger module

class graphlow.util.logger.DefaultLoggerFactory[source]

Bases: object

graphlow.util.logger.get_graphlow_logger()[source]
Return type:

Logger

graphlow.util.logger.get_logger(name)[source]

This is designed to get logger inside graphlow library itself. If you are user of this library and want to get library root logger, use ‘get_graphlow_logger’ instead.

Parameters:

name (str) – name of logger

Return type:

logging.Logger

graphlow.util.typing module

Module contents