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#
- read_matrix_market(contents)#
Read a graph from Matrix Market format string contents.
Matrix Market is a human-readable ASCII file format for storing sparse matrices as coordinate format (row, column, value) triplets. This function parses Matrix Market formatted string contents and converts it to a graph representation.
For more information about Matrix Market format, see: https://math.nist.gov/MatrixMarket/formats.html
- Parameters:
contents (str) – The Matrix Market formatted string contents to parse.
- Returns:
A graph object constructed from the Matrix Market data. Returns a
PyDiGraphfor directed matrices or aPyGraphfor undirected matrices.- Return type:
- Raises:
ValueError – when the Matrix Market string contains invalid data or format.