Exemplo n.º 1
0
def test_k_truss_fail():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat10_symmetric"))

    with raises(GaloisError):
        k_truss(property_graph, 2, "output")

    with raises(GaloisError):
        k_truss(property_graph, 1, "output2")
Exemplo n.º 2
0
def test_louvain_clustering():
    property_graph = PropertyGraph(
        get_input("propertygraphs/rmat10_symmetric"))

    louvain_clustering(property_graph, "value", "output")

    louvain_clustering_assert_valid(property_graph, "value", "output")

    LouvainClusteringStatistics(property_graph, "value", "output")
Exemplo n.º 3
0
def test_triangle_count_presorted():
    property_graph = PropertyGraph(
        get_input("propertygraphs/rmat15_cleaned_symmetric"))
    sort_nodes_by_degree(property_graph)
    sort_all_edges_by_dest(property_graph)
    n = triangle_count(
        property_graph,
        TriangleCountPlan.node_iteration(relabeling=False, edges_sorted=True))
    assert n == 282617
Exemplo n.º 4
0
def test_k_truss():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat10_symmetric"))

    k_truss(property_graph, 10, "output")

    stats = KTrussStatistics(property_graph, 10, "output")

    assert stats.number_of_edges_left == 13338

    k_truss_assert_valid(property_graph, 10, "output")
Exemplo n.º 5
0
def test_k_core():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat10_symmetric"))

    k_core(property_graph, 10, "output")

    stats = KCoreStatistics(property_graph, 10, "output")

    assert stats.number_of_nodes_in_kcore == 438

    k_core_assert_valid(property_graph, 10, "output")
Exemplo n.º 6
0
def test_local_clustering_coefficient():
    property_graph = PropertyGraph(
        get_input("propertygraphs/rmat15_cleaned_symmetric"))

    local_clustering_coefficient(property_graph, "output")
    property_graph: PropertyGraph
    out = property_graph.get_node_property("output")

    assert out[-1].as_py() == 0
    assert not np.any(np.isnan(out))
Exemplo n.º 7
0
def test_connected_components():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat10_symmetric"))

    connected_components(property_graph, "output")

    stats = ConnectedComponentsStatistics(property_graph, "output")

    assert stats.total_components == 69
    assert stats.total_non_trivial_components == 1
    assert stats.largest_component_size == 957
    assert stats.largest_component_ratio == approx(0.93457)

    connected_components_assert_valid(property_graph, "output")
Exemplo n.º 8
0
def test_independent_set():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat10_symmetric"))

    independent_set(property_graph, "output")

    stats = IndependentSetStatistics(property_graph, "output")

    independent_set_assert_valid(property_graph, "output")

    independent_set(property_graph, "output2", IndependentSetPlan.pull())

    stats = IndependentSetStatistics(property_graph, "output2")

    independent_set_assert_valid(property_graph, "output2")
Exemplo n.º 9
0
def test_triangle_count():
    property_graph = PropertyGraph(get_input("propertygraphs/rmat15_cleaned_symmetric"))
    original_first_edge_list = [property_graph.get_edge_dst(e) for e in property_graph.edges(0)]
    n = triangle_count(property_graph)
    assert n == 282617

    n = triangle_count(property_graph, TriangleCountPlan.node_iteration())
    assert n == 282617

    n = triangle_count(property_graph, TriangleCountPlan.edge_iteration())
    assert n == 282617

    assert [property_graph.get_edge_dst(e) for e in property_graph.edges(0)] == original_first_edge_list

    sort_all_edges_by_dest(property_graph)
    n = triangle_count(property_graph, TriangleCountPlan.ordered_count(edges_sorted=True))
    assert n == 282617
Exemplo n.º 10
0
def test_subgraph_extraction():
    property_graph = PropertyGraph(
        get_input("propertygraphs/rmat15_cleaned_symmetric"))
    sort_all_edges_by_dest(property_graph)
    nodes = [1, 3, 11, 120]

    expected_edges = [[
        nodes.index(property_graph.get_edge_dest(e))
        for e in property_graph.edges(i)
        if property_graph.get_edge_dest(e) in nodes
    ] for i in nodes]

    pg = subgraph_extraction(property_graph, nodes)

    assert isinstance(pg, PropertyGraph)
    assert len(pg) == len(nodes)
    assert pg.num_edges() == 6

    for i, _ in enumerate(expected_edges):
        assert len(pg.edges(i)) == len(expected_edges[i])
        assert [pg.get_edge_dest(e) for e in pg.edges(i)] == expected_edges[i]
Exemplo n.º 11
0
def property_graph():
    g = PropertyGraph(get_input("propertygraphs/ldbc_003"))
    return g