Example #1
0
def test_from_adj_matrix():
    graph = Graph.from_adjacency_matrix([[None, 2, 3], [4, None, 6],
                                         [7, None, None]])

    assert graph.get_number_of_nodes() == 3
    assert len(list(graph.get_edges())) == 5
Example #2
0
def test_from_matrix_not_square():
    with pytest.raises(ValueError):
        graph = Graph.from_adjacency_matrix([[None, 2, 3], [4, None, 6]])