easygraph.datasets.hypergraph.House_Committees module#
- class easygraph.datasets.hypergraph.House_Committees.House_Committees(data_root=None)[source]#
Bases:
objectA class for loading and processing the House Committees hypergraph dataset.
This class fetches hyperedge, node label, node name, and label name data from predefined URLs, processes the data, and generates a hypergraph representation. It also provides access to various dataset attributes through properties and indexing.
- data_root#
The root URL for the data. If data_root is provided during initialization, it is set to “https://”; otherwise, it is None.
- Type:
str
- hyperedges_path#
The URL of the file containing hyperedge information.
- Type:
str
- node_labels_path#
The URL of the file containing node label information.
- Type:
str
- node_names_path#
The URL of the file containing node name information.
- Type:
str
- label_names_path#
The URL of the file containing label name information.
- Type:
str
- _hyperedges#
A list of tuples representing hyperedges.
- Type:
list
- _node_labels#
A list of node labels.
- Type:
list
- _label_names#
A list of label names.
- Type:
list
- _node_names#
A list of node names.
- Type:
list
- _content#
A dictionary containing dataset statistics and data, including the number of classes, vertices, edges, the edge list, and node labels.
- Type:
dict
- generate_hypergraph(hyperedges_path=None, node_labels_path=None, node_names_path=None, label_names_path=None)[source]#
Generates a hypergraph by fetching and processing data from the specified URLs.
- Parameters:
hyperedges_path (str, optional) – The URL of the file containing hyperedge information. Defaults to None.
node_labels_path (str, optional) – The URL of the file containing node label information. Defaults to None.
node_names_path (str, optional) – The URL of the file containing node name information. Defaults to None.
label_names_path (str, optional) – The URL of the file containing label name information. Defaults to None.
- property hyperedges#
Gets the list of hyperedges.
- Returns:
A list of tuples representing hyperedges.
- Return type:
list
- property label_names#
Gets the list of label names.
- Returns:
A list of label names.
- Return type:
list
- property node_labels#
Gets the list of node labels.
- Returns:
A list of node labels.
- Return type:
list
- property node_names#
Gets the list of node names.
- Returns:
A list of node names.
- Return type:
list
- process_label_txt(data_str, delimiter='\n', transform_fun=<class 'str'>)[source]#
Processes a string containing label data into a list of transformed values.
- Args:
data_str (str): The input string containing label data. delimiter (str, optional): The delimiter used to split the input string. Defaults to “
- “.
- transform_fun (callable, optional): A function used to transform each label value.
Defaults to the str function.
- Returns:
list: A list of transformed label values.
- easygraph.datasets.hypergraph.House_Committees.request_text_from_url(url)[source]#
Requests text data from the specified URL.
- Parameters:
url (str) – The URL from which to request the text data.
- Returns:
The text content of the response if the request is successful.
- Return type:
str
- Raises:
EasyGraphError – If a connection error occurs during the request or if the HTTP response status code indicates a failure.