xgi.readwrite.xgi_data#
Load a data set from the xgi-data repository or a local file.
Functions
- load_xgi_data(dataset=None, cache=True, read=False, path='', nodetype=None, edgetype=None, max_order=None)[source]#
Load a data set from the xgi-data repository or a local file.
- Parameters:
dataset (str, optional) – Dataset name. Valid options are the top-level tags of the index.json file in the xgi-data repository. If None (default), prints the list of available datasets.
cache (bool, optional) – Whether to cache the input data, by default True.
read (bool, optional) – If read==True, search for a local copy of the data set. Use the local copy if it exists, otherwise use the xgi-data repository. By default, False.
path (str, optional) – Path to a local copy of the data set
nodetype (type, optional) – Type to cast the node ID to, by default None.
edgetype (type, optional) – Type to cast the edge ID to, by default None.
max_order (int, optional) – Maximum order of edges to add to the hypergraph, by default None.
- Returns:
The loaded hypergraph. If the dataset chosen is a collection, returns a dictionary of Hypergraph objects.
- Return type:
- Raises:
XGIError – The specified dataset does not exist.
- download_xgi_data(dataset, path='', collection_name='')[source]#
Make a local copy of a dataset in the xgi-data repository.
If the dataset is a collection, makes local copies of all the datasets in the collection and a main file pointing to all of the datasets.
- Parameters:
dataset (str) – Dataset name. Valid options are the top-level tags of the index.json file in the xgi-data repository.
path (str, optional) – Directory where the local copy should be saved. If none is given, save file to local directory.
collection_name (str, optional) – The name of the collection of data (if any). If dataset is not a collection, this argument is unused.