network_complement
- compas.datastructures.network_complement(network, cls=None)[source]
Generate the complement network of a network.
The complement of a graph G is the graph H with the same vertices but whose edges consists of the edges not present in the graph G [1].
- Parameters:
- network
compas.datastructures.Network
A network.
- network
- Returns:
compas.datastructures.Network
The complement network.
References
[1]Wolfram MathWorld. Graph complement. Available at: http://mathworld.wolfram.com/GraphComplement.html.
Examples
>>> import compas >>> from compas.datastructures import Network >>> from compas.datastructures import network_complement >>> network = Network.from_obj(compas.get('lines.obj')) >>> complement = network_complement(network) >>> any(complement.has_edge(u, v, directed=False) for u, v in network.edges()) False