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_usingis not provided, the type of the output is selected based in directionality of the inputnetwork. For directed networks, the output would would be of typenetworkx.DiGraph, and for undirected networks it would produce an instance ofnetworkx.Graph.Raises a
ModuleNotFoundErrorif NetworkX is not installed or cannot be imported at the time the 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
gis directed, i.e., whethernetworkx.is_directed(g)returnsTrue.Raises a
ModuleNotFoundErrorif NetworkX is not installed or cannot be imported at the time the the function is called.