Esempio n. 1
0
def arrow_property_graph_lpa(graphscope_session):
    g = Graph(graphscope_session, generate_eid=False)
    g = g.add_vertices(f"{property_dir}/lpa_dataset/lpa_3000_v_0", "v0")
    g = g.add_vertices(f"{property_dir}/lpa_dataset/lpa_3000_v_1", "v1")
    g = g.add_edges(f"{property_dir}/lpa_dataset/lpa_3000_e_0", "e0",
                    ["weight"], "v0", "v1")
    yield g
    g.unload()
Esempio n. 2
0
def p2p_property_graph_undirected(graphscope_session):
    g = Graph(graphscope_session, directed=False, generate_eid=False)
    g = g.add_vertices(f"{property_dir}/p2p-31_property_v_0", "person")
    g = g.add_edges(
        f"{property_dir}/p2p-31_property_e_0",
        label="knows",
        src_label="person",
        dst_label="person",
    )
    yield g
    g.unload()
Esempio n. 3
0
def test_load_graph_copy(graphscope_session, arrow_property_graph):
    g = arrow_property_graph
    g2 = Graph(graphscope_session, g)
    assert g.key != g2.key
    assert g.vineyard_id != g2.vineyard_id
    assert str(g.schema) == str(g2.schema)
    assert np.all(g.to_numpy("v:v0.id") == g2.to_numpy("v:v0.id"))
    g2.unload()
    assert not g2.loaded()
    # test load from vineyard's graph
    g3 = Graph(graphscope_session, vineyard.ObjectID(g.vineyard_id))
    assert g3.loaded()
Esempio n. 4
0
def test_error_on_operation_on_graph(graphscope_session):
    g = Graph(graphscope_session.session_id)
    with pytest.raises(RuntimeError,
                       match="The graph is not registered in remote"):
        g.project_to_simple(v_label=0, v_prop=0, e_label=0, e_prop=0)

    with pytest.raises(RuntimeError,
                       match="The graph is not registered in remote"):
        g.unload()

    with pytest.raises(AssertionError):
        property_sssp(g, src=6)
Esempio n. 5
0
def arrow_property_graph_only_from_efile(graphscope_session):
    g = Graph(graphscope_session, generate_eid=False)
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_0_0", "e0", ["weight"],
                    "v0", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_1_0", "e0", ["weight"],
                    "v0", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_0_0", "e0", ["weight"],
                    "v1", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_1_0", "e0", ["weight"],
                    "v1", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_0_1", "e1", ["weight"],
                    "v0", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_1_1", "e1", ["weight"],
                    "v0", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_0_1", "e1", ["weight"],
                    "v1", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_1_1", "e1", ["weight"],
                    "v1", "v1")

    yield g
    g.unload()
Esempio n. 6
0
def test_unload(graphscope_session):
    graph = Graph(graphscope_session)
    prefix = os.path.expandvars("${GS_TEST_DIR}/property")
    graph = (Graph(graphscope_session).add_vertices(
        f"{prefix}/p2p-31_property_v_0",
        "person").add_edges(f"{prefix}/p2p-31_property_e_0", "knows"))
    assert graph.loaded()
    assert graph.vineyard_id is not None
    graph.unload()

    assert not graph.loaded()

    with pytest.raises(RuntimeError, match="The graph is not loaded"):
        graph.unload()

    with pytest.raises(RuntimeError, match="The graph is not loaded"):
        graph.project_to_simple(v_label="person", e_label="knows")
    with pytest.raises(AssertionError):
        g2 = Graph(graphscope_session, graph)
    with pytest.raises(RuntimeError, match="The graph is not loaded"):
        property_sssp(graph, src=6)
Esempio n. 7
0
def arrow_property_graph_undirected(graphscope_session):
    g = Graph(graphscope_session, directed=False, generate_eid=False)
    g = g.add_vertices(f"{new_property_dir}/twitter_v_0", "v0")
    g = g.add_vertices(f"{new_property_dir}/twitter_v_1", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_0_0", "e0", ["weight"],
                    "v0", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_1_0", "e0", ["weight"],
                    "v0", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_0_0", "e0", ["weight"],
                    "v1", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_1_0", "e0", ["weight"],
                    "v1", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_0_1", "e1", ["weight"],
                    "v0", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_0_1_1", "e1", ["weight"],
                    "v0", "v1")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_0_1", "e1", ["weight"],
                    "v1", "v0")
    g = g.add_edges(f"{new_property_dir}/twitter_e_1_1_1", "e1", ["weight"],
                    "v1", "v1")

    yield g
    g.unload()