download_graph: Download Sparse Matrix form the SuiteSparse Matrix Collection

View source: R/download_graph.R

download_graphR Documentation

Download Sparse Matrix form the SuiteSparse Matrix Collection

Description

download_graph allows to download sparse matrices from the SuiteSparse Matrix Collection.

Usage

download_graph(matrixname, groupname, svd = FALSE, add_info = FALSE)

Arguments

matrixname

Name of the graph to download.

groupname

Name of the group that provides the graph.

svd

Logical, if TRUE, a ".mat" file containing the singular values of the matrix is downloaded (if available). Default is FALSE.

add_info

Logical, if TRUE, additional information about the graph will be fetched and included in the output. Default is FALSE.

Details

download_graph automatically converts the downloaded matrix into a sparse matrix format. If coordinates are associated with the graphs, they are downloaded and included in the output. Visit https://sparse.tamu.edu/ or see SuiteSparseData to explore groups and matrix names.

Value

A list containing several components:

  • sA: A sparse matrix representation of the downloaded graph.

  • xy: Coordinates associated with the graph nodes (if available).

  • dim: A data frame with the number of rows, columns, and numerically nonzero elements.

  • temp: The path to the temporary directory where the matrix and downloaded files (including singular values if requested) are stored.

  • info: Additional information about the graph (included when add_info is TRUE).

Note

This temporary directory can be accessed, for example, via list.files(grid1$temp). To open the read .mat files (containing singular values), "R.matlab" or "foreign" packages can be used. After using the downloaded data, you can delete the content of the temporary folder.

When add_info is set to TRUE, the function retrieves comprehensive information about the graph using get_graph_info.

References

Davis, T. A., & Hu, Y. (2011). The University of Florida sparse matrix collection. ACM Transactions on Mathematical Software (TOMS), 38(1), 1-25.

Kolodziej, S. P., Aznaveh, M., Bullock, M., David, J., Davis, T. A., Henderson, M., Hu, Y., & Sandstrom, R. (2019). The suitesparse matrix collection website interface. Journal of Open Source Software, 4(35), 1244.

See Also

get_graph_info, SuiteSparseData

Examples

## Not run: 
matrixname <- "grid1"
groupname <- "AG-Monien"
download_graph(matrixname,groupname)
list.files(grid1$temp)

## End(Not run)

gasper documentation built on May 29, 2024, 8:32 a.m.