xgi.convert.hypergraph_dict#
Method for converting from a standardized dictionary.
Functions
- to_hypergraph_dict(H)[source]#
A method to convert a hypergraph into a standard dictionary format.
- Parameters:
H (Hypergraph) – The hypergraph to convert
- Returns:
A dictionary of the form described in xgi-org/xgi-data.
- Return type:
dict
- Raises:
XGIError – If node IDs will be collapsed when casting to a string.
XGIError – If edge Ids will be collapsed when casting to a string.
See also
- from_hypergraph_dict(data, nodetype=None, edgetype=None, max_order=None)[source]#
A function to read a file in a standardized JSON format.
- Parameters:
data (dict) – A dictionary in the hypergraph JSON format
nodetype (type, optional) – Type that the node IDs will be cast to
edgetype (type, optional) – Type that the edge IDs will be cast to
max_order (int, optional) – Maximum order of edges to add to the hypergraph
- Returns:
The loaded hypergraph
- Return type:
A Hypergraph object
- Raises:
XGIError – If the JSON is not in a format that can be loaded.
See also