Constructions¶
This module provides constructions of graphs.
- pyrigi.graph._constructions.constructions.cone(graph, inplace=False, vertex=None)[source]¶
Return a coned version of the graph.
Definitions
- Parameters:
- Return type:
Examples
>>> g = Graph([(0,1)]) >>> G = cone(g) >>> nx.is_isomorphic(G, Graph([(0,1),(1,2),(0,2)])) True
- pyrigi.graph._constructions.constructions.intersection(graph, other_graph)[source]¶
Return the intersection with
other_graph.Examples
>>> H = Graph([[1,2],[2,3],[3,1],[3,4]]) >>> G = Graph([[0,1],[1,2],[2,3],[3,1]]) >>> graph = intersection(G, H) >>> print(graph) Graph with vertices [1, 2, 3] and edges [[1, 2], [1, 3], [2, 3]] >>> G = Graph([[0,1],[0,2],[1,2]]) >>> G.add_node(3) >>> H = Graph([[0,1],[1,2],[2,4],[4,0]]) >>> H.add_node(3) >>> graph = intersection(G, H) >>> print(graph) Graph with vertices [0, 1, 2, 3] and edges [[0, 1], [1, 2]]
- pyrigi.graph._constructions.constructions.sum_t(graph, other_graph, edge, t=2)[source]¶
Return the
t-sum withother_graphalong the given edge.- Return type:
- Parameters:
Definitions
Examples
>>> G1 = Graph([[1,2],[2,3],[3,1],[3,4]]) >>> G2 = Graph([[0,1],[1,2],[2,3],[3,1]]) >>> H = sum_t(G2, G1, [1, 2], 3) >>> print(H) Graph with vertices [0, 1, 2, 3, 4] and edges [[0, 1], [1, 3], [2, 3], [3, 4]]