networkcommons.utils.read_network_from_file

networkcommons.utils.read_network_from_file(file_path, source_col='source', target_col='target', directed=True, sep='\t')

Read network from a file.

Parameters:
  • file_path (str) – Path to the file.

  • source_col (str) – Column name for the source nodes.

  • target_col (str) – Column name for the target nodes.

  • directed (bool) – Whether the network is directed or not.

  • sep (str) – Delimiter for the file.

Returns:

The network.

Return type:

nx.Graph or nx.DiGraph