File IO¶
Functions for loading graphs from files and storing them in files.
-
load_edgelist(filepath, *, nodelist=None, file_source_col='Source', file_target_col='Target', file_channel_col='eType')¶ Load an edgelist file into a Graph object.
TODO: optional argument for putting the edgelist in a pandas dataframe.
Parameters: - filepath (str) – Path to the edgelist file. File should be csv formatted with columns corresponding to the source, target, and channel of each edge.
- nodelist (DataFrame, optional) – Nodes of the graph and their attributes. Should have a column named by the value of node_col. Extracted from the source and target columns of the edgelist if not provided.
- file_source_col (str, optional) – Name of the column in the csv corresponding to the source node.
- file_target_col (str, optional) – Name of the column in the csv corresponding to the target node.
- file_channel_col (str, optional) – Name of the column in the csv corresponding to the edge type.
Returns: The graph represented by the edgelist.
Return type: