예제 #1
0
    def test_component_list(self):
        g = SimpleGraph()
        g.from_graph_sequence([4, 3, 3, 2, 2, 1, 1])
        comps = g.component_list()

        assert [1, 2, 3, 4, 5] in comps.values()
        assert [6, 7] in comps.values()
예제 #2
0
def example03():
    """Największa wspólna składowa"""
    g = SimpleGraph().from_graph_sequence([4, 3, 3, 2, 2, 1, 1])
    g.save(filename="graph3", file_format="png", color_components=True)
    pprint(g.component_list())
    print(f"Największa składowa: {g.largest_component()}")