Input/Output and interoperation#

Edgelist input/output#

Reading an edgelist file#

read_edgelist[edge_type](path: str)#
template<network_edge EdgeT>
network<EdgeT> read_edgelist(std::filesystem::path path)#

Dyadic static and temporal networks can be read from space separated files where each row represents an edge. Note that vertices with no neighbours cannot be represented in this format.

Writing an edgelist file#

write_edgelist(network, path: str)#
template<network_edge EdgeT>
void write_edgelist(const network<EdgeT> &g, std::filesystem::path path)#

Write a dyadic static and temporal networks in form of space separated files where each row represents an edge. Note that vertices with no neighbours cannot be represented in this format.

Interoperation with NetworkX#

to_networkx(network, create_using=None)#

Creates a NetworkX graph from a dyadic static network. If created_using is not provided, the type of the output is selected based in directionality of the input network. For directed networks, the output would would be of type networkx.DiGraph, and for undirected networks it would produce an instance of networkx.Graph.

Raises a ModuleNotFoundError if NetworkX is not installed or cannot be imported at the time the first time an interoperation function is called.

from_networkx[vertex_type](g)#

Creates a dyadic static network from a NetworkX graph. The directedness of the network is decided based on whether graph g is directed, i.e., whether networkx.is_directed(g) returns True.

Raises a ModuleNotFoundError if NetworkX is not installed or cannot be imported at the time the first time an interoperation function is called.