Cartesian product#

cartesian_product(    g1: undirected_network[vertex_type1],     g2: undirected_network[vertex_type2]) -> undirected_network[pair[vertex_type1, vertex_type2]]
template<network_vertex VertT1, network_vertex VertT2>
undirected_network<std::pair<VertT1, VertT2>> cartesian_product(const undirected_network<VertT1> &g1, const undirected_network<VertT2> &g2)#

Calculates graph cartesian product of two undirected networks g1 and g1.


While in C++ there are no limits on the types of vertices of the network (as long as they satisfy network_vertex) the Python binding only supports certain vertex types. This function is not implemented for cases that would produce output vertices too complex to be predefined, i.e., when vertex_type1 or vertex_type2 are not a simple numerical or string type. In these cases you might want to relabel the vertices of the networks before calling this function.