Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.read_matrix_market_file#

read_matrix_market_file(path)#

Read a graph from a Matrix Market format file.

Matrix Market is a human-readable ASCII file format for storing sparse matrices as coordinate format (row, column, value) triplets. This function reads a Matrix Market file and converts it to a graph representation.

For more information about Matrix Market format, see: https://math.nist.gov/MatrixMarket/formats.html

Parameters:

path (str) – The file path to read the Matrix Market data from.

Returns:

A graph object constructed from the Matrix Market file.

Return type:

PyGraph or PyDiGraph

Raises:
  • IOError – when an error occurs during file reading or parsing.

  • ValueError – when the Matrix Market file contains invalid data or format.