diff --git a/python/cugraph/cugraph/testing/__init__.py b/python/cugraph/cugraph/testing/__init__.py index cf22c0093a4..bd9314608b1 100644 --- a/python/cugraph/cugraph/testing/__init__.py +++ b/python/cugraph/cugraph/testing/__init__.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from cugraph.testing.resultset import get_resultset +# from cugraph.testing.resultset import get_resultset, get_resultset2 from cugraph.testing.utils import RAPIDS_DATASET_ROOT_DIR_PATH, RAPIDS_DATASET_ROOT_DIR +from cugraph.testing.resultset import load_resultset, get_resultset from cugraph.datasets import ( cyber, dolphins, diff --git a/python/cugraph/cugraph/testing/generate_resultsets.py b/python/cugraph/cugraph/testing/generate_resultsets.py new file mode 100644 index 00000000000..d3ad2625792 --- /dev/null +++ b/python/cugraph/cugraph/testing/generate_resultsets.py @@ -0,0 +1,325 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from tempfile import NamedTemporaryFile +import random + +import numpy as np +import networkx as nx + +import cudf +import cugraph +from cugraph.experimental.datasets import ( + dolphins, + netscience, + karate_disjoint, + karate, + polbooks, +) +from cugraph.testing import utils + + +_results_dir = utils.RAPIDS_DATASET_ROOT_DIR_PATH / "tests" / "resultsets" +_resultsets = {} + + +def add_resultset(result_data_dictionary, **kwargs): + rs = utils.Resultset(result_data_dictionary) + hashable_dict_repr = tuple((k, kwargs[k]) for k in sorted(kwargs.keys())) + _resultsets[hashable_dict_repr] = rs + + +# ============================================================================= +# Parameters +# ============================================================================= +# This will be refactored once the datasets variables are fixed/changed +SEEDS = [42] + +DIRECTED_GRAPH_OPTIONS = [True, False] + +DEPTH_LIMITS = [None, 1, 5, 18] + +DATASETS = [dolphins, netscience, karate_disjoint] + +DATASETS_SMALL = [karate, dolphins, polbooks] + +# ============================================================================= +# tests/traversal/test_bfs.py +# ============================================================================= +test_bfs_results = {} + +for ds in DATASETS + [karate]: + for seed in SEEDS: + for depth_limit in DEPTH_LIMITS: + for dirctd in DIRECTED_GRAPH_OPTIONS: + # this does the work of get_cu_graph_nx_results_and_params + Gnx = utils.generate_nx_graph_from_file(ds.get_path(), directed=dirctd) + random.seed(seed) + start_vertex = random.sample(list(Gnx.nodes()), 1)[0] + nx_values = nx.single_source_shortest_path_length( + Gnx, start_vertex, cutoff=depth_limit + ) + """test_bfs_results[ + "{},{},{},{},{}".format(seed, depth_limit, ds, dirctd, start_vertex) + ] = nx_values""" + vertices = cudf.Series(nx_values.keys()) + distances = cudf.Series(nx_values.values()) + add_resultset( + {"vertex": vertices, "distance": distances}, + graph_dataset=ds.metadata["name"], + graph_directed=str(dirctd), + algo="single_source_shortest_path_length", + start_vertex=str(start_vertex), + cutoff=str(depth_limit), + ) + # test_bfs_results["{},{},starts".format(seed, ds)] = start_vertex + +# these are pandas dataframes +for dirctd in DIRECTED_GRAPH_OPTIONS: + Gnx = utils.generate_nx_graph_from_file(karate.get_path(), directed=dirctd) + result = cugraph.bfs_edges(Gnx, source=7) + cugraph_df = cudf.from_pandas(result) + # test_bfs_results["{},{},{}".format(ds, dirctd, "nonnative-nx")] = cugraph_df + add_resultset( + cugraph_df, + graph_dataset="karate", + graph_directed=str(dirctd), + algo="bfs_edges", + source="7", + ) + + +# ============================================================================= +# tests/traversal/test_sssp.py +# ============================================================================= +test_sssp_results = {} + +SOURCES = [1] + +for ds in DATASETS_SMALL: + for source in SOURCES: + Gnx = utils.generate_nx_graph_from_file(ds.get_path(), directed=True) + nx_paths = nx.single_source_dijkstra_path_length(Gnx, source) + # test_sssp_results["{},{},ssdpl".format(ds, source)] = nx_paths + vertices = cudf.Series(nx_paths.keys()) + distances = cudf.Series(nx_paths.values()) + add_resultset( + {"vertex": vertices, "distance": distances}, + graph_dataset=ds.metadata["name"], + graph_directed="True", + algo="single_source_dijkstra_path_length", + source=str(source), + ) + + M = utils.read_csv_for_nx(ds.get_path(), read_weights_in_sp=True) + edge_attr = "weight" + Gnx = nx.from_pandas_edgelist( + M, + source="0", + target="1", + edge_attr=edge_attr, + create_using=nx.DiGraph(), + ) + + M["weight"] = M["weight"].astype(np.int32) + Gnx = nx.from_pandas_edgelist( + M, + source="0", + target="1", + edge_attr="weight", + create_using=nx.DiGraph(), + ) + nx_paths_datatypeconv = nx.single_source_dijkstra_path_length(Gnx, source) + """test_sssp_results[ + "nx_paths,data_type_conversion,{}".format(ds) + ] = nx_paths_datatypeconv""" + vertices_datatypeconv = cudf.Series(nx_paths_datatypeconv.keys()) + distances_datatypeconv = cudf.Series(nx_paths_datatypeconv.values()) + add_resultset( + {"vertex": vertices_datatypeconv, "distance": distances_datatypeconv}, + graph_dataset=ds.metadata["name"], + graph_directed="True", + algo="single_source_dijkstra_path_length", + test="data_type_conversion", + source=str(source), + ) + +for dirctd in DIRECTED_GRAPH_OPTIONS: + for source in SOURCES: + Gnx = utils.generate_nx_graph_from_file( + karate.get_path(), directed=dirctd, edgevals=True + ) + """if dirctd: + test_sssp_results[ + "nonnative_input,nx.DiGraph,{}".format(source) + ] = cugraph.sssp(Gnx, source) + else: + test_sssp_results[ + "nonnative_input,nx.Graph,{}".format(source) + ] = cugraph.sssp(Gnx, source)""" + add_resultset( + cugraph.sssp(Gnx, source), + graph_dataset="karate", + graph_directed=str(dirctd), + algo="sssp_nonnative", + source=str(source), + ) + +G = nx.Graph() +G.add_edge(0, 1, other=10) +G.add_edge(1, 2, other=20) +df = cugraph.sssp(G, 0, edge_attr="other") +# test_sssp_results["network_edge_attr"] = df +add_resultset(df, algo="sssp_nonnative", test="network_edge_attr") + +# ============================================================================= +# tests/traversal/test_paths.py +# ============================================================================= +CONNECTED_GRAPH = """1,5,3 +1,4,1 +1,2,1 +1,6,2 +1,7,2 +4,5,1 +2,3,1 +7,6,2 +""" + +DISCONNECTED_GRAPH = CONNECTED_GRAPH + "8,9,4" + +paths = [("1", "1"), ("1", "5"), ("1", "3"), ("1", "6")] +invalid_paths = { + "connected": [("-1", "1"), ("0", "42")], + "disconnected": [("1", "10"), ("1", "8")], +} + +with NamedTemporaryFile(mode="w+", suffix=".csv") as graph_tf: + graph_tf.writelines(DISCONNECTED_GRAPH) + graph_tf.seek(0) + Gnx_DIS = nx.read_weighted_edgelist(graph_tf.name, delimiter=",") + +res1 = nx.shortest_path_length(Gnx_DIS, source="1", weight="weight") +vertices = cudf.Series(res1.keys()) +distances = cudf.Series(res1.values()) +add_resultset( + {"vertex": vertices, "distance": distances}, + algo="shortest_path_length", + graph_dataset="DISCONNECTED", + graph_directed="True", + source="1", + weight="weight", +) + + +# Generating ALL results files +"""random.seed(24) +for temp in _resultsets: + res = _resultsets[temp].get_cudf_dataframe() + # Currently, only traversal results files are generated + temp_filename = "traversal-" + str(random.getrandbits(55)) + ".csv" + temp_mapping = cudf.DataFrame( + [[str(temp), temp_filename]], columns=["hashable_dict_repr", "filename"] + ) + traversal_mappings = cudf.concat( + [traversal_mappings, temp_mapping], axis=0, ignore_index=True + ) + # print(temp_filename) + # print("traversal_" + temp_filename) + res.to_csv(results_dir / temp_filename, index=False) +traversal_mappings.to_csv(results_dir / "traversal_mappings.csv", index=False)""" + + +def generate_results(): + # FIXME: Currently, only traversal results files are generated + random.seed(24) + traversal_mappings = cudf.DataFrame( + columns=[ + "#UUID", + "arg0", + "arg0val", + "arg1", + "arg1val", + "arg2", + "arg2val", + "arg3", + "arg3val", + "arg4", + "arg4val", + "arg5", + "arg5val", + "arg6", + "arg6val", + "arg7", + "arg7val", + "arg8", + "arg8val", + "arg9", + "arg9val", + ] + ) + # Generating ALL results files + for temp in _resultsets: + res = _resultsets[temp].get_cudf_dataframe() + # temp_filename = "traversal-" + str(random.getrandbits(55)) + ".csv" + temp_filename = str(random.getrandbits(50)) + temp_dict = dict(temp) + argnames, argvals = [t for t in temp_dict.keys()], [ + t for t in temp_dict.values() + ] + single_mapping = np.empty(21, dtype=object) + dict_length = len(argnames) + + single_mapping[0] = temp_filename + # single_mapping[1] = argvals[0] + # for i in np.arange(1, dict_length): + for i in np.arange(dict_length): + # single_mapping[2 * i] = argnames[i] + # single_mapping[2 * i + 1] = argvals[i] + single_mapping[2 * i + 1] = argnames[i] + single_mapping[2 * i + 2] = argvals[i] + temp_mapping = cudf.DataFrame( + [single_mapping], + columns=[ + "#UUID", + "arg0", + "arg0val", + "arg1", + "arg1val", + "arg2", + "arg2val", + "arg3", + "arg3val", + "arg4", + "arg4val", + "arg5", + "arg5val", + "arg6", + "arg6val", + "arg7", + "arg7val", + "arg8", + "arg8val", + "arg9", + "arg9val", + ], + ) + traversal_mappings = cudf.concat( + [traversal_mappings, temp_mapping], axis=0, ignore_index=True + ) + res.to_csv(_results_dir / (temp_filename + ".csv"), index=False) + traversal_mappings.to_csv( + _results_dir / "traversal_mappings.csv", index=False, sep=" " + ) + + +# generate_results() diff --git a/python/cugraph/cugraph/testing/results/traversal-1038281390523078.csv b/python/cugraph/cugraph/testing/results/traversal-1038281390523078.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-1038281390523078.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-1081121981713141.csv b/python/cugraph/cugraph/testing/results/traversal-1081121981713141.csv deleted file mode 100644 index dd3b38a55c6..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-1081121981713141.csv +++ /dev/null @@ -1,6 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-1120419326843553.csv b/python/cugraph/cugraph/testing/results/traversal-1120419326843553.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-1120419326843553.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-1124485822090487.csv b/python/cugraph/cugraph/testing/results/traversal-1124485822090487.csv deleted file mode 100644 index 84194972ecf..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-1124485822090487.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 -56,6 -32,6 -60,7 diff --git a/python/cugraph/cugraph/testing/results/traversal-14314120729501.csv b/python/cugraph/cugraph/testing/results/traversal-14314120729501.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-14314120729501.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-172188670880910.csv b/python/cugraph/cugraph/testing/results/traversal-172188670880910.csv deleted file mode 100644 index 227b61d8259..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-172188670880910.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -1,0 -17,1 -19,1 -26,1 -27,1 -28,1 -36,1 -41,1 -54,1 -6,2 -9,2 -13,2 -22,2 -25,2 -31,2 -57,2 -7,2 -30,2 -8,2 -20,2 -47,2 -23,2 -37,2 -39,2 -40,2 -59,2 -56,3 -5,3 -32,3 -48,3 -42,3 -3,3 -45,3 -16,3 -18,3 -38,3 -44,3 -50,3 -0,3 -10,3 -51,3 -14,3 -21,3 -33,3 -34,3 -43,3 -61,3 -15,3 -52,3 -60,4 -2,4 -24,4 -29,4 -58,4 -4,4 -11,4 -55,4 -12,4 -49,4 -46,4 -53,4 -35,5 diff --git a/python/cugraph/cugraph/testing/results/traversal-188398733063004.csv b/python/cugraph/cugraph/testing/results/traversal-188398733063004.csv deleted file mode 100644 index 3a273143f56..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-188398733063004.csv +++ /dev/null @@ -1,8 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-189882724201031.csv b/python/cugraph/cugraph/testing/results/traversal-189882724201031.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-189882724201031.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-190697381576149.csv b/python/cugraph/cugraph/testing/results/traversal-190697381576149.csv deleted file mode 100644 index 384b1e3707b..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-190697381576149.csv +++ /dev/null @@ -1,60 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 diff --git a/python/cugraph/cugraph/testing/results/traversal-223015853235383.csv b/python/cugraph/cugraph/testing/results/traversal-223015853235383.csv deleted file mode 100644 index 7ae0b62a55c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-223015853235383.csv +++ /dev/null @@ -1,8 +0,0 @@ -vertex,distance -1,0.0 -4,1.0 -2,1.0 -6,2.0 -7,2.0 -5,2.0 -3,2.0 diff --git a/python/cugraph/cugraph/testing/results/traversal-240638103958132.csv b/python/cugraph/cugraph/testing/results/traversal-240638103958132.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-240638103958132.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-245745928001428.csv b/python/cugraph/cugraph/testing/results/traversal-245745928001428.csv deleted file mode 100644 index 3a273143f56..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-245745928001428.csv +++ /dev/null @@ -1,8 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-276948497384571.csv b/python/cugraph/cugraph/testing/results/traversal-276948497384571.csv deleted file mode 100644 index dda4c0b31ba..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-276948497384571.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -1,0 -0,1 -2,1 -3,1 -7,1 -13,1 -17,1 -19,1 -21,1 -30,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -31,2 -9,2 -27,2 -28,2 -32,2 -33,2 -16,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-285876289784674.csv b/python/cugraph/cugraph/testing/results/traversal-285876289784674.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-285876289784674.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-308351777319316.csv b/python/cugraph/cugraph/testing/results/traversal-308351777319316.csv deleted file mode 100644 index 4ce6a683be2..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-308351777319316.csv +++ /dev/null @@ -1,4 +0,0 @@ -distance,vertex,predecessor -10.0,1,0 -0.0,0,-1 -30.0,2,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-31714534985100.csv b/python/cugraph/cugraph/testing/results/traversal-31714534985100.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-31714534985100.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-319050385288308.csv b/python/cugraph/cugraph/testing/results/traversal-319050385288308.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-319050385288308.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-319914331540810.csv b/python/cugraph/cugraph/testing/results/traversal-319914331540810.csv deleted file mode 100644 index 5b2270cb9ed..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-319914331540810.csv +++ /dev/null @@ -1,35 +0,0 @@ -distance,vertex,predecessor -2.0,33,13 -1.0,0,1 -2.0,32,2 -1.0,2,1 -0.0,1,-1 -1.0,3,1 -2.0,31,0 -2.0,8,0 -1.0,13,1 -3.0,23,33 -2.0,5,0 -2.0,6,0 -1.0,7,1 -2.0,27,2 -3.0,29,33 -1.0,30,1 -2.0,4,0 -2.0,10,0 -1.0,19,1 -3.0,24,31 -3.0,25,31 -2.0,28,2 -2.0,9,2 -2.0,12,0 -3.0,14,33 -3.0,15,33 -3.0,16,5 -1.0,17,1 -3.0,18,33 -3.0,20,33 -1.0,21,1 -3.0,22,33 -3.0,26,33 -2.0,11,0 diff --git a/python/cugraph/cugraph/testing/results/traversal-349902694645046.csv b/python/cugraph/cugraph/testing/results/traversal-349902694645046.csv deleted file mode 100644 index dda4c0b31ba..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-349902694645046.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -1,0 -0,1 -2,1 -3,1 -7,1 -13,1 -17,1 -19,1 -21,1 -30,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -31,2 -9,2 -27,2 -28,2 -32,2 -33,2 -16,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-37447363258930.csv b/python/cugraph/cugraph/testing/results/traversal-37447363258930.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-37447363258930.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-381600612247751.csv b/python/cugraph/cugraph/testing/results/traversal-381600612247751.csv deleted file mode 100644 index d7178211365..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-381600612247751.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance,predecessor -33,3,32 -0,1,7 -32,2,2 -2,1,7 -1,1,7 -3,1,7 -31,2,0 -8,2,0 -13,2,0 -23,3,32 -5,2,0 -6,2,0 -7,0,-1 -27,2,2 -29,3,32 -30,2,1 -4,2,0 -10,2,0 -19,2,0 -24,3,31 -25,3,31 -28,2,2 -9,2,2 -12,2,0 -14,3,32 -15,3,32 -16,3,5 -17,2,0 -18,3,32 -20,3,32 -21,2,0 -22,3,32 -26,4,33 -11,2,0 diff --git a/python/cugraph/cugraph/testing/results/traversal-431063157185576.csv b/python/cugraph/cugraph/testing/results/traversal-431063157185576.csv deleted file mode 100644 index 84194972ecf..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-431063157185576.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 -56,6 -32,6 -60,7 diff --git a/python/cugraph/cugraph/testing/results/traversal-526650785538532.csv b/python/cugraph/cugraph/testing/results/traversal-526650785538532.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-526650785538532.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-551177413608707.csv b/python/cugraph/cugraph/testing/results/traversal-551177413608707.csv deleted file mode 100644 index 2bf79ebfc3e..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-551177413608707.csv +++ /dev/null @@ -1,106 +0,0 @@ -vertex,distance -1,0 -0,1 -3,1 -5,1 -6,1 -2,2 -4,2 -8,2 -9,2 -10,2 -11,2 -12,2 -13,2 -14,2 -15,2 -16,2 -17,2 -18,2 -19,2 -20,2 -21,2 -22,2 -23,2 -24,2 -25,2 -26,2 -27,2 -7,2 -29,2 -28,3 -30,3 -31,3 -32,3 -33,3 -35,3 -37,3 -40,3 -41,3 -42,3 -43,3 -44,3 -45,3 -46,3 -47,3 -48,3 -49,3 -50,3 -51,3 -52,3 -38,3 -39,3 -55,3 -56,3 -36,3 -54,3 -57,3 -58,3 -77,3 -53,3 -71,3 -85,3 -66,4 -72,4 -67,4 -70,4 -73,4 -74,4 -75,4 -76,4 -79,4 -80,4 -82,4 -83,4 -84,4 -86,4 -93,4 -99,4 -78,4 -91,4 -34,4 -102,4 -64,4 -65,4 -69,4 -68,4 -81,4 -88,5 -89,5 -90,5 -96,5 -97,5 -100,5 -87,5 -92,5 -103,5 -104,5 -94,5 -95,5 -98,5 -60,5 -62,5 -101,5 -61,5 -59,5 -63,5 diff --git a/python/cugraph/cugraph/testing/results/traversal-553165838223190.csv b/python/cugraph/cugraph/testing/results/traversal-553165838223190.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-553165838223190.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-562676383765605.csv b/python/cugraph/cugraph/testing/results/traversal-562676383765605.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-562676383765605.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-633044963923492.csv b/python/cugraph/cugraph/testing/results/traversal-633044963923492.csv deleted file mode 100644 index 5b2270cb9ed..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-633044963923492.csv +++ /dev/null @@ -1,35 +0,0 @@ -distance,vertex,predecessor -2.0,33,13 -1.0,0,1 -2.0,32,2 -1.0,2,1 -0.0,1,-1 -1.0,3,1 -2.0,31,0 -2.0,8,0 -1.0,13,1 -3.0,23,33 -2.0,5,0 -2.0,6,0 -1.0,7,1 -2.0,27,2 -3.0,29,33 -1.0,30,1 -2.0,4,0 -2.0,10,0 -1.0,19,1 -3.0,24,31 -3.0,25,31 -2.0,28,2 -2.0,9,2 -2.0,12,0 -3.0,14,33 -3.0,15,33 -3.0,16,5 -1.0,17,1 -3.0,18,33 -3.0,20,33 -1.0,21,1 -3.0,22,33 -3.0,26,33 -2.0,11,0 diff --git a/python/cugraph/cugraph/testing/results/traversal-656150055689627.csv b/python/cugraph/cugraph/testing/results/traversal-656150055689627.csv deleted file mode 100644 index 84194972ecf..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-656150055689627.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 -56,6 -32,6 -60,7 diff --git a/python/cugraph/cugraph/testing/results/traversal-671563943115481.csv b/python/cugraph/cugraph/testing/results/traversal-671563943115481.csv deleted file mode 100644 index 227b61d8259..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-671563943115481.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -1,0 -17,1 -19,1 -26,1 -27,1 -28,1 -36,1 -41,1 -54,1 -6,2 -9,2 -13,2 -22,2 -25,2 -31,2 -57,2 -7,2 -30,2 -8,2 -20,2 -47,2 -23,2 -37,2 -39,2 -40,2 -59,2 -56,3 -5,3 -32,3 -48,3 -42,3 -3,3 -45,3 -16,3 -18,3 -38,3 -44,3 -50,3 -0,3 -10,3 -51,3 -14,3 -21,3 -33,3 -34,3 -43,3 -61,3 -15,3 -52,3 -60,4 -2,4 -24,4 -29,4 -58,4 -4,4 -11,4 -55,4 -12,4 -49,4 -46,4 -53,4 -35,5 diff --git a/python/cugraph/cugraph/testing/results/traversal-688340850412339.csv b/python/cugraph/cugraph/testing/results/traversal-688340850412339.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-688340850412339.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-715146362591693.csv b/python/cugraph/cugraph/testing/results/traversal-715146362591693.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-715146362591693.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-730687934441562.csv b/python/cugraph/cugraph/testing/results/traversal-730687934441562.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-730687934441562.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-743945746483767.csv b/python/cugraph/cugraph/testing/results/traversal-743945746483767.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-743945746483767.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-766965872267210.csv b/python/cugraph/cugraph/testing/results/traversal-766965872267210.csv deleted file mode 100644 index 828e48615f0..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-766965872267210.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 -4,2 -5,2 -6,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -19,2 -21,2 -31,2 -30,2 -9,2 -27,2 -28,2 -32,2 -16,3 -33,3 -24,3 -25,3 -23,3 -14,3 -15,3 -18,3 -20,3 -22,3 -29,3 -26,4 diff --git a/python/cugraph/cugraph/testing/results/traversal-767470587558788.csv b/python/cugraph/cugraph/testing/results/traversal-767470587558788.csv deleted file mode 100644 index 384b1e3707b..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-767470587558788.csv +++ /dev/null @@ -1,60 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 diff --git a/python/cugraph/cugraph/testing/results/traversal-767697247244749.csv b/python/cugraph/cugraph/testing/results/traversal-767697247244749.csv deleted file mode 100644 index 23e577378c6..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-767697247244749.csv +++ /dev/null @@ -1,5 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-773751608857007.csv b/python/cugraph/cugraph/testing/results/traversal-773751608857007.csv deleted file mode 100644 index 6ac28e23f8c..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-773751608857007.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 -2,2 -3,2 -4,2 -5,2 -6,2 -7,2 -8,2 -10,2 -11,2 -12,2 -13,2 -17,2 -21,2 -31,2 -30,2 -9,2 -14,2 -15,2 -18,2 -20,2 -22,2 -23,2 -26,2 -27,2 -28,2 -29,2 -32,2 -16,3 -24,3 -25,3 diff --git a/python/cugraph/cugraph/testing/results/traversal-794754027574210.csv b/python/cugraph/cugraph/testing/results/traversal-794754027574210.csv deleted file mode 100644 index 84194972ecf..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-794754027574210.csv +++ /dev/null @@ -1,63 +0,0 @@ -vertex,distance -16,0 -14,1 -20,1 -33,1 -37,1 -38,1 -50,1 -0,2 -3,2 -24,2 -34,2 -40,2 -43,2 -52,2 -8,2 -18,2 -28,2 -36,2 -44,2 -47,2 -12,2 -21,2 -45,2 -61,2 -58,2 -42,2 -51,2 -10,3 -15,3 -59,3 -29,3 -49,3 -7,3 -46,3 -53,3 -1,3 -30,3 -23,3 -39,3 -2,3 -4,3 -11,3 -55,3 -35,4 -19,4 -27,4 -54,4 -17,4 -26,4 -41,4 -57,4 -25,5 -6,5 -13,5 -9,5 -22,5 -31,5 -5,5 -48,5 -56,6 -32,6 -60,7 diff --git a/python/cugraph/cugraph/testing/results/traversal-811808371982955.csv b/python/cugraph/cugraph/testing/results/traversal-811808371982955.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-811808371982955.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-836556098128760.csv b/python/cugraph/cugraph/testing/results/traversal-836556098128760.csv deleted file mode 100644 index d7178211365..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-836556098128760.csv +++ /dev/null @@ -1,35 +0,0 @@ -vertex,distance,predecessor -33,3,32 -0,1,7 -32,2,2 -2,1,7 -1,1,7 -3,1,7 -31,2,0 -8,2,0 -13,2,0 -23,3,32 -5,2,0 -6,2,0 -7,0,-1 -27,2,2 -29,3,32 -30,2,1 -4,2,0 -10,2,0 -19,2,0 -24,3,31 -25,3,31 -28,2,2 -9,2,2 -12,2,0 -14,3,32 -15,3,32 -16,3,5 -17,2,0 -18,3,32 -20,3,32 -21,2,0 -22,3,32 -26,4,33 -11,2,0 diff --git a/python/cugraph/cugraph/testing/results/traversal-83873432859770.csv b/python/cugraph/cugraph/testing/results/traversal-83873432859770.csv deleted file mode 100644 index dd3b38a55c6..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-83873432859770.csv +++ /dev/null @@ -1,6 +0,0 @@ -vertex,distance -7,0 -0,1 -1,1 -2,1 -3,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-907905196596504.csv b/python/cugraph/cugraph/testing/results/traversal-907905196596504.csv deleted file mode 100644 index a09c207f808..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-907905196596504.csv +++ /dev/null @@ -1,3 +0,0 @@ -vertex,distance -1237,0 -1238,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-951630488463330.csv b/python/cugraph/cugraph/testing/results/traversal-951630488463330.csv deleted file mode 100644 index 23e577378c6..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-951630488463330.csv +++ /dev/null @@ -1,5 +0,0 @@ -vertex,distance -19,0 -0,1 -1,1 -33,1 diff --git a/python/cugraph/cugraph/testing/results/traversal-954435445708700.csv b/python/cugraph/cugraph/testing/results/traversal-954435445708700.csv deleted file mode 100644 index 2bf79ebfc3e..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal-954435445708700.csv +++ /dev/null @@ -1,106 +0,0 @@ -vertex,distance -1,0 -0,1 -3,1 -5,1 -6,1 -2,2 -4,2 -8,2 -9,2 -10,2 -11,2 -12,2 -13,2 -14,2 -15,2 -16,2 -17,2 -18,2 -19,2 -20,2 -21,2 -22,2 -23,2 -24,2 -25,2 -26,2 -27,2 -7,2 -29,2 -28,3 -30,3 -31,3 -32,3 -33,3 -35,3 -37,3 -40,3 -41,3 -42,3 -43,3 -44,3 -45,3 -46,3 -47,3 -48,3 -49,3 -50,3 -51,3 -52,3 -38,3 -39,3 -55,3 -56,3 -36,3 -54,3 -57,3 -58,3 -77,3 -53,3 -71,3 -85,3 -66,4 -72,4 -67,4 -70,4 -73,4 -74,4 -75,4 -76,4 -79,4 -80,4 -82,4 -83,4 -84,4 -86,4 -93,4 -99,4 -78,4 -91,4 -34,4 -102,4 -64,4 -65,4 -69,4 -68,4 -81,4 -88,5 -89,5 -90,5 -96,5 -97,5 -100,5 -87,5 -92,5 -103,5 -104,5 -94,5 -95,5 -98,5 -60,5 -62,5 -101,5 -61,5 -59,5 -63,5 diff --git a/python/cugraph/cugraph/testing/results/traversal_mappings.csv b/python/cugraph/cugraph/testing/results/traversal_mappings.csv deleted file mode 100644 index f0e38d6f4ef..00000000000 --- a/python/cugraph/cugraph/testing/results/traversal_mappings.csv +++ /dev/null @@ -1,45 +0,0 @@ -UUID algo arg1 arg1val arg2 arg2val arg3 arg3val arg4 arg4val arg5 arg5val arg6 arg6val arg7 arg7val arg8 arg8val arg9 arg9val -431063157185576 single_source_shortest_path_length cutoff None graph_dataset dolphins graph_directed True start_vertex 16 -656150055689627 single_source_shortest_path_length cutoff None graph_dataset dolphins graph_directed False start_vertex 16 -245745928001428 single_source_shortest_path_length cutoff 1 graph_dataset dolphins graph_directed True start_vertex 16 -188398733063004 single_source_shortest_path_length cutoff 1 graph_dataset dolphins graph_directed False start_vertex 16 -190697381576149 single_source_shortest_path_length cutoff 5 graph_dataset dolphins graph_directed True start_vertex 16 -767470587558788 single_source_shortest_path_length cutoff 5 graph_dataset dolphins graph_directed False start_vertex 16 -794754027574210 single_source_shortest_path_length cutoff 18 graph_dataset dolphins graph_directed True start_vertex 16 -1124485822090487 single_source_shortest_path_length cutoff 18 graph_dataset dolphins graph_directed False start_vertex 16 -907905196596504 single_source_shortest_path_length cutoff None graph_dataset netscience graph_directed True start_vertex 1237 -319050385288308 single_source_shortest_path_length cutoff None graph_dataset netscience graph_directed False start_vertex 1237 -1038281390523078 single_source_shortest_path_length cutoff 1 graph_dataset netscience graph_directed True start_vertex 1237 -14314120729501 single_source_shortest_path_length cutoff 1 graph_dataset netscience graph_directed False start_vertex 1237 -526650785538532 single_source_shortest_path_length cutoff 5 graph_dataset netscience graph_directed True start_vertex 1237 -811808371982955 single_source_shortest_path_length cutoff 5 graph_dataset netscience graph_directed False start_vertex 1237 -715146362591693 single_source_shortest_path_length cutoff 18 graph_dataset netscience graph_directed True start_vertex 1237 -31714534985100 single_source_shortest_path_length cutoff 18 graph_dataset netscience graph_directed False start_vertex 1237 -189882724201031 single_source_shortest_path_length cutoff None graph_dataset karate-disjoint graph_directed True start_vertex 19 -553165838223190 single_source_shortest_path_length cutoff None graph_dataset karate-disjoint graph_directed False start_vertex 19 -951630488463330 single_source_shortest_path_length cutoff 1 graph_dataset karate-disjoint graph_directed True start_vertex 19 -767697247244749 single_source_shortest_path_length cutoff 1 graph_dataset karate-disjoint graph_directed False start_vertex 19 -562676383765605 single_source_shortest_path_length cutoff 5 graph_dataset karate-disjoint graph_directed True start_vertex 19 -1120419326843553 single_source_shortest_path_length cutoff 5 graph_dataset karate-disjoint graph_directed False start_vertex 19 -773751608857007 single_source_shortest_path_length cutoff 18 graph_dataset karate-disjoint graph_directed True start_vertex 19 -285876289784674 single_source_shortest_path_length cutoff 18 graph_dataset karate-disjoint graph_directed False start_vertex 19 -688340850412339 single_source_shortest_path_length cutoff None graph_dataset karate graph_directed True start_vertex 7 -766965872267210 single_source_shortest_path_length cutoff None graph_dataset karate graph_directed False start_vertex 7 -1081121981713141 single_source_shortest_path_length cutoff 1 graph_dataset karate graph_directed True start_vertex 7 -83873432859770 single_source_shortest_path_length cutoff 1 graph_dataset karate graph_directed False start_vertex 7 -730687934441562 single_source_shortest_path_length cutoff 5 graph_dataset karate graph_directed True start_vertex 7 -743945746483767 single_source_shortest_path_length cutoff 5 graph_dataset karate graph_directed False start_vertex 7 -37447363258930 single_source_shortest_path_length cutoff 18 graph_dataset karate graph_directed True start_vertex 7 -240638103958132 single_source_shortest_path_length cutoff 18 graph_dataset karate graph_directed False start_vertex 7 -381600612247751 bfs_edges graph_dataset karate graph_directed True source 7 -836556098128760 bfs_edges graph_dataset karate graph_directed False source 7 -349902694645046 single_source_dijkstra_path_length graph_dataset karate graph_directed True source 1 -276948497384571 single_source_dijkstra_path_length graph_dataset karate graph_directed True source 1 test data_type_conversion -671563943115481 single_source_dijkstra_path_length graph_dataset dolphins graph_directed True source 1 -172188670880910 single_source_dijkstra_path_length graph_dataset dolphins graph_directed True source 1 test data_type_conversion -954435445708700 single_source_dijkstra_path_length graph_dataset polbooks graph_directed True source 1 -551177413608707 single_source_dijkstra_path_length graph_dataset polbooks graph_directed True source 1 test data_type_conversion -319914331540810 sssp_nonnative graph_dataset karate graph_directed True source 1 -633044963923492 sssp_nonnative graph_dataset karate graph_directed False source 1 -308351777319316 sssp_nonnative test network_edge_attr -223015853235383 shortest_path_length graph_dataset DISCONNECTED graph_directed True source 1 weight weight diff --git a/python/cugraph/cugraph/testing/resultset.py b/python/cugraph/cugraph/testing/resultset.py index 0a5f188e624..1b232914f22 100644 --- a/python/cugraph/cugraph/testing/resultset.py +++ b/python/cugraph/cugraph/testing/resultset.py @@ -11,338 +11,107 @@ # See the License for the specific language governing permissions and # limitations under the License. -from tempfile import NamedTemporaryFile -import random -from pathlib import Path - -import numpy as np -import networkx as nx +import tarfile import cudf -import cugraph -from cugraph.experimental.datasets import ( - dolphins, - netscience, - karate_disjoint, - karate, - polbooks, -) -from cugraph.testing import utils - -results_dir = Path("testing/results") - -_resultsets = {} - - -def add_resultset(result_data_dictionary, **kwargs): - rs = utils.ResultSet(result_data_dictionary) - hashable_dict_repr = tuple((k, kwargs[k]) for k in sorted(kwargs.keys())) - _resultsets[hashable_dict_repr] = rs - - -def get_resultset(category, **kwargs): - hashable_dict_repr = tuple((k, kwargs[k]) for k in sorted(kwargs.keys())) - mappings_path = results_dir / (category + "_mappings.csv") - # Had to set dtype=str to prevent 1s being converted to True - mappings = cudf.read_csv(mappings_path, sep=" ", dtype=str) - colnames = mappings.columns - query_cols = [t for t in colnames][1:] - dict_repr = dict(hashable_dict_repr) - argnames, argvals = [t for t in dict_repr.keys()], [t for t in dict_repr.values()] - mapping_length = 2 * len(argvals) - 1 - single_mapping = np.empty(mapping_length, dtype=object) - single_mapping[0] = argvals[0] - for i in np.arange(1, len(argvals)): - single_mapping[2 * i - 1] = argnames[i] - single_mapping[2 * i] = argvals[i] - for i in np.arange(mapping_length): - mappings = mappings[mappings[query_cols[i]] == single_mapping[i]] - # values_host is used instead of values bc strings aren't saved/possible on device - results_filename = category + "-" + mappings.head(1)["UUID"].values_host[0] - # results_filename = mappings.head(1)["UUID"].values_host[0] - results_filename = results_filename + ".csv" - # Ignore for now -> Assumption is the filename already has the alg category - path = results_dir / results_filename - # path = Path("https://data.rapids.ai/cugraph/results/" / path - return cudf.read_csv(path) - - -# ============================================================================= -# Parameters -# ============================================================================= -# This will be refactored once the datasets variables are fixed/changed -SEEDS = [42] +from cugraph.testing import RAPIDS_DATASET_ROOT_DIR_PATH -DIRECTED_GRAPH_OPTIONS = [True, False] - -DEPTH_LIMITS = [None, 1, 5, 18] - -DATASETS = [dolphins, netscience, karate_disjoint] - -DATASETS_SMALL = [karate, dolphins, polbooks] - -# ============================================================================= -# tests/traversal/test_bfs.py -# ============================================================================= -test_bfs_results = {} - -for ds in DATASETS + [karate]: - for seed in SEEDS: - for depth_limit in DEPTH_LIMITS: - for dirctd in DIRECTED_GRAPH_OPTIONS: - # this does the work of get_cu_graph_nx_results_and_params - Gnx = utils.generate_nx_graph_from_file(ds.get_path(), directed=dirctd) - random.seed(seed) - start_vertex = random.sample(list(Gnx.nodes()), 1)[0] - nx_values = nx.single_source_shortest_path_length( - Gnx, start_vertex, cutoff=depth_limit - ) - """test_bfs_results[ - "{},{},{},{},{}".format(seed, depth_limit, ds, dirctd, start_vertex) - ] = nx_values""" - vertices = cudf.Series(nx_values.keys()) - distances = cudf.Series(nx_values.values()) - add_resultset( - {"vertex": vertices, "distance": distances}, - graph_dataset=ds.metadata["name"], - graph_directed=str(dirctd), - algo="single_source_shortest_path_length", - start_vertex=str(start_vertex), - cutoff=str(depth_limit), - ) - # test_bfs_results["{},{},starts".format(seed, ds)] = start_vertex - -# these are pandas dataframes -for dirctd in DIRECTED_GRAPH_OPTIONS: - Gnx = utils.generate_nx_graph_from_file(karate.get_path(), directed=dirctd) - result = cugraph.bfs_edges(Gnx, source=7) - cugraph_df = cudf.from_pandas(result) - # test_bfs_results["{},{},{}".format(ds, dirctd, "nonnative-nx")] = cugraph_df - add_resultset( - cugraph_df, - graph_dataset="karate", - graph_directed=str(dirctd), - algo="bfs_edges", - source="7", - ) +class Resultset: + def __init__(self, data_dictionary): + self._data_dictionary = data_dictionary -# ============================================================================= -# tests/traversal/test_sssp.py -# ============================================================================= -test_sssp_results = {} + def get_cudf_dataframe(self): + # This is called in testing/resultset.py before writing all results to files + return cudf.DataFrame(self._data_dictionary) -SOURCES = [1] -for ds in DATASETS_SMALL: - for source in SOURCES: - Gnx = utils.generate_nx_graph_from_file(ds.get_path(), directed=True) - nx_paths = nx.single_source_dijkstra_path_length(Gnx, source) - # test_sssp_results["{},{},ssdpl".format(ds, source)] = nx_paths - vertices = cudf.Series(nx_paths.keys()) - distances = cudf.Series(nx_paths.values()) - add_resultset( - {"vertex": vertices, "distance": distances}, - graph_dataset=ds.metadata["name"], - graph_directed="True", - algo="single_source_dijkstra_path_length", - source=str(source), - ) - - M = utils.read_csv_for_nx(ds.get_path(), read_weights_in_sp=True) - edge_attr = "weight" - Gnx = nx.from_pandas_edgelist( - M, - source="0", - target="1", - edge_attr=edge_attr, - create_using=nx.DiGraph(), - ) - - M["weight"] = M["weight"].astype(np.int32) - Gnx = nx.from_pandas_edgelist( - M, - source="0", - target="1", - edge_attr="weight", - create_using=nx.DiGraph(), - ) - nx_paths_datatypeconv = nx.single_source_dijkstra_path_length(Gnx, source) - """test_sssp_results[ - "nx_paths,data_type_conversion,{}".format(ds) - ] = nx_paths_datatypeconv""" - vertices_datatypeconv = cudf.Series(nx_paths_datatypeconv.keys()) - distances_datatypeconv = cudf.Series(nx_paths_datatypeconv.values()) - add_resultset( - {"vertex": vertices_datatypeconv, "distance": distances_datatypeconv}, - graph_dataset=ds.metadata["name"], - graph_directed="True", - algo="single_source_dijkstra_path_length", - test="data_type_conversion", - source=str(source), - ) - -for dirctd in DIRECTED_GRAPH_OPTIONS: - for source in SOURCES: - Gnx = utils.generate_nx_graph_from_file( - karate.get_path(), directed=dirctd, edgevals=True - ) - """if dirctd: - test_sssp_results[ - "nonnative_input,nx.DiGraph,{}".format(source) - ] = cugraph.sssp(Gnx, source) - else: - test_sssp_results[ - "nonnative_input,nx.Graph,{}".format(source) - ] = cugraph.sssp(Gnx, source)""" - add_resultset( - cugraph.sssp(Gnx, source), - graph_dataset="karate", - graph_directed=str(dirctd), - algo="sssp_nonnative", - source=str(source), - ) - -G = nx.Graph() -G.add_edge(0, 1, other=10) -G.add_edge(1, 2, other=20) -df = cugraph.sssp(G, 0, edge_attr="other") -# test_sssp_results["network_edge_attr"] = df -add_resultset(df, algo="sssp_nonnative", test="network_edge_attr") - -# ============================================================================= -# tests/traversal/test_paths.py -# ============================================================================= -CONNECTED_GRAPH = """1,5,3 -1,4,1 -1,2,1 -1,6,2 -1,7,2 -4,5,1 -2,3,1 -7,6,2 -""" - -DISCONNECTED_GRAPH = CONNECTED_GRAPH + "8,9,4" - -paths = [("1", "1"), ("1", "5"), ("1", "3"), ("1", "6")] -invalid_paths = { - "connected": [("-1", "1"), ("0", "42")], - "disconnected": [("1", "10"), ("1", "8")], -} - -with NamedTemporaryFile(mode="w+", suffix=".csv") as graph_tf: - graph_tf.writelines(DISCONNECTED_GRAPH) - graph_tf.seek(0) - Gnx_DIS = nx.read_weighted_edgelist(graph_tf.name, delimiter=",") - -res1 = nx.shortest_path_length(Gnx_DIS, source="1", weight="weight") -vertices = cudf.Series(res1.keys()) -distances = cudf.Series(res1.values()) -add_resultset( - {"vertex": vertices, "distance": distances}, - algo="shortest_path_length", - graph_dataset="DISCONNECTED", - graph_directed="True", - source="1", - weight="weight", -) +_resultsets = {} -# Generating ALL results files -"""random.seed(24) -for temp in _resultsets: - res = _resultsets[temp].get_cudf_dataframe() - # Currently, only traversal results files are generated - temp_filename = "traversal-" + str(random.getrandbits(55)) + ".csv" - temp_mapping = cudf.DataFrame( - [[str(temp), temp_filename]], columns=["hashable_dict_repr", "filename"] - ) - traversal_mappings = cudf.concat( - [traversal_mappings, temp_mapping], axis=0, ignore_index=True +def load_resultset(resultset_name, resultset_download_url): + """ + Read a mapping file (.csv) in the _results_dir and save the + mappings between each unique set of args/identifiers to UUIDs to the + _resultsets dictionary. If .csv does not exist in + _results_dir, use resultset_download_url to download a file to + install/unpack/etc. to _results_dir first. + """ + # mapping_file_path = ( + # RAPIDS_RESULTSET_ROOT_DIR_PATH + # / (resultset_name + "_mappings.csv") + # ) + mapping_file_path = ( + RAPIDS_DATASET_ROOT_DIR_PATH + / "tests" + / "resultsets" + / (resultset_name + "_mappings.csv") ) - # print(temp_filename) - # print("traversal_" + temp_filename) - res.to_csv(results_dir / temp_filename, index=False) -traversal_mappings.to_csv(results_dir / "traversal_mappings.csv", index=False)""" - - -def generate_results(): - random.seed(24) - # traversal_mappings = cudf.DataFrame(columns=["hashable_dict_repr", "filename"]) - traversal_mappings = cudf.DataFrame( - columns=[ - "UUID", - "algo", - "arg1", - "arg1val", - "arg2", - "arg2val", - "arg3", - "arg3val", - "arg4", - "arg4val", - "arg5", - "arg5val", - "arg6", - "arg6val", - "arg7", - "arg7val", - "arg8", - "arg8val", - "arg9", - "arg9val", - ] - ) - # Generating ALL results files - for temp in _resultsets: - res = _resultsets[temp].get_cudf_dataframe() - # Currently, only traversal results files are generated - # temp_filename = "traversal-" + str(random.getrandbits(55)) + ".csv" - temp_filename = str(random.getrandbits(50)) - temp_dict = dict(temp) - argnames, argvals = [t for t in temp_dict.keys()], [ - t for t in temp_dict.values() + if not mapping_file_path.exists(): + # Downloads a tar gz from s3 bucket, then decompresses the zipped results files + compressed_file_dir = RAPIDS_DATASET_ROOT_DIR_PATH / "tests" + compressed_file_path = compressed_file_dir / "resultsets.tar.gz" + if not compressed_file_path.exists(): + # FIXME: download a tar gz from s3 bucket + raise FileNotFoundError(compressed_file_path, "zipped data not found") + # Currently, it expects to have at least resultsets.tar.gz + tar = tarfile.open(str(compressed_file_path), "r:gz") + tar.extractall(str(compressed_file_dir)) + tar.close() + + # FIXME: This assumes separator is " ", but should this be configurable? + sep = " " + with open(mapping_file_path) as mapping_file: + for line in mapping_file.readlines(): + if line.startswith("#"): + continue + + (uuid, *row_args) = line.split(sep) + if (len(row_args) % 2) != 0: + raise ValueError( + f'bad row in {mapping_file_path}: "{line}", must ' + "contain UUID followed by an even number of items" + ) + row_keys = row_args[::2] + row_vals = row_args[1::2] + row_keys = " ".join(row_keys).split() + row_vals = " ".join(row_vals).split() + arg_dict = dict(zip(row_keys, row_vals)) + arg_dict["resultset_name"] = resultset_name + # Create a unique string key for the _resultsets dict based on + # sorted row_keys. Looking up results based on args will also have + # to sort, but this will ensure results can looked up without + # requiring maintaining a specific order. Example: + # {'a': 1, 'z': 9, 'c': 5, 'b': 2} becomes 'a-1-b-2-c-5-z-9' + resultset_key = "-".join( + [ + str(val) + for arg_dict_pair in sorted(arg_dict.items()) + for val in arg_dict_pair + ] + ) + + _resultsets[resultset_key] = uuid + + +def get_resultset(resultset_name, **kwargs): + arg_dict = dict(kwargs) + arg_dict["resultset_name"] = resultset_name + # Example: + # {'a': 1, 'z': 9, 'c': 5, 'b': 2} becomes 'a-1-b-2-c-5-z-9' + resultset_key = "-".join( + [ + str(val) + for arg_dict_pair in sorted(arg_dict.items()) + for val in arg_dict_pair ] - single_mapping = np.empty(20, dtype=object) - dict_length = len(argnames) - single_mapping[0] = temp_filename - single_mapping[1] = argvals[0] - for i in np.arange(1, dict_length): - single_mapping[2 * i] = argnames[i] - single_mapping[2 * i + 1] = argvals[i] - temp_mapping = cudf.DataFrame( - [single_mapping], - columns=[ - "UUID", - "algo", - "arg1", - "arg1val", - "arg2", - "arg2val", - "arg3", - "arg3val", - "arg4", - "arg4val", - "arg5", - "arg5val", - "arg6", - "arg6val", - "arg7", - "arg7val", - "arg8", - "arg8val", - "arg9", - "arg9val", - ], - ) - traversal_mappings = cudf.concat( - [traversal_mappings, temp_mapping], axis=0, ignore_index=True - ) - res.to_csv(results_dir / ("traversal-" + temp_filename + ".csv"), index=False) - traversal_mappings.to_csv( - results_dir / "traversal_mappings.csv", index=False, sep=" " ) + uuid = _resultsets.get(resultset_key) + if uuid is None: + raise KeyError(f"results for {arg_dict} not found") - -# generate_results() + # results_filename = RAPIDS_RESULTSET_ROOT_DIR_PATH / (uuid + ".csv") + results_filename = ( + RAPIDS_DATASET_ROOT_DIR_PATH / "tests" / "resultsets" / (uuid + ".csv") + ) + return cudf.read_csv(results_filename) diff --git a/python/cugraph/cugraph/testing/utils.py b/python/cugraph/cugraph/testing/utils.py index 5fc5c81ab6a..793063eb3ed 100644 --- a/python/cugraph/cugraph/testing/utils.py +++ b/python/cugraph/cugraph/testing/utils.py @@ -414,17 +414,3 @@ def compare_mst(mst_cugraph, mst_nx): print(cg_sum) print(nx_sum) assert np.isclose(cg_sum, nx_sum) - - -default_results_download_dir = ( - Path(os.environ.get("RAPIDS_DATASET_ROOT_DIR")) / "results" -) - - -class ResultSet: - def __init__(self, data_dictionary): - self._data_dictionary = data_dictionary - - def get_cudf_dataframe(self): - # This is called in testing/resultset.py before writing all results to files - return cudf.DataFrame(self._data_dictionary) diff --git a/python/cugraph/cugraph/tests/traversal/test_bfs.py b/python/cugraph/cugraph/tests/traversal/test_bfs.py index c10ee473a4e..d4eca46ef65 100644 --- a/python/cugraph/cugraph/tests/traversal/test_bfs.py +++ b/python/cugraph/cugraph/tests/traversal/test_bfs.py @@ -26,7 +26,13 @@ from cupyx.scipy.sparse import csr_matrix as cp_csr_matrix from cupyx.scipy.sparse import csc_matrix as cp_csc_matrix from pylibcugraph.testing.utils import gen_fixture_params_product -from cugraph.testing import utils, get_resultset, DEFAULT_DATASETS, SMALL_DATASETS +from cugraph.testing import ( + utils, + get_resultset, + load_resultset, + DEFAULT_DATASETS, + SMALL_DATASETS, +) # ============================================================================= @@ -181,7 +187,7 @@ def func_to_benchmark(): raise NotImplementedError("Invalid type for start_vertex") -def _compare_bfs(cugraph_df, nx_distances, source): +def _compare_bfs(cugraph_df, golden_distances, source): # This call should only contain 3 columns: # 'vertex', 'distance', 'predecessor' # It also confirms wether or not 'sp_counter' has been created by the call @@ -213,10 +219,10 @@ def _compare_bfs(cugraph_df, nx_distances, source): missing_vertex_error = 0 distance_mismatch_error = 0 invalid_predecessor_error = 0 - for vertex in nx_distances: + for vertex in golden_distances: if vertex in cu_distances: result = cu_distances[vertex] - expected = nx_distances[vertex] + expected = golden_distances[vertex] if result != expected: print( "[ERR] Mismatch on distances: " @@ -227,12 +233,12 @@ def _compare_bfs(cugraph_df, nx_distances, source): missing_vertex_error += 1 else: pred = cu_predecessors[vertex] - if vertex != source and pred not in nx_distances: + if vertex != source and pred not in golden_distances: invalid_predecessor_error += 1 else: # The graph is unweighted thus, predecessors are 1 away if vertex != source and ( - (nx_distances[pred] + 1 != cu_distances[vertex]) + (golden_distances[pred] + 1 != cu_distances[vertex]) ): print( "[ERR] Invalid on predecessors: " @@ -257,24 +263,27 @@ def get_cu_graph_and_params(dataset, directed): return (G, dataset_path, dataset_name, directed) -def get_cu_graph_nx_results_and_params( - seed, depth_limit, G, dataset_path, dataset_name, directed +def get_cu_graph_golden_results_and_params( + seed, depth_limit, G, dataset_path, dataset_name, directed, load_results ): """ Helper for fixtures returning Nx results and params. """ start_vertex = DATASET_STARTS[dataset_name] - nx_values = get_resultset( - category="traversal", + golden_values = get_resultset( + resultset_name="traversal", algo="single_source_shortest_path_length", cutoff=str(depth_limit), graph_dataset=dataset_name, graph_directed=str(directed), start_vertex=str(start_vertex), ) - nx_values = cudf.Series(nx_values.distance.values, index=nx_values.vertex).to_dict() - return (G, dataset_path, directed, nx_values, start_vertex, depth_limit) + golden_values = cudf.Series( + golden_values.distance.values, index=golden_values.vertex + ).to_dict() + + return (G, dataset_path, directed, golden_values, start_vertex, depth_limit) # ============================================================================= @@ -316,21 +325,26 @@ def get_cu_graph_nx_results_and_params( ) +@pytest.fixture(scope="module") +def load_traversal_results(): + return load_resultset("traversal", None) + + # Fixtures that result in a test-per (dataset X directed/undirected) # combination. These return the path to the dataset, a bool indicating if a # directed graph is being used, and the Nx graph object. @pytest.fixture(scope="module", params=graph_fixture_params) -def dataset_nx_results(request): +def dataset_golden_results(request): return get_cu_graph_and_params(*request.param) @pytest.fixture(scope="module", params=small_graph_fixture_params) -def small_dataset_nx_results(request): +def small_dataset_golden_results(request): return get_cu_graph_and_params(*request.param) @pytest.fixture(scope="module", params=single_small_graph_fixture_params) -def single_small_dataset_nx_results(request): +def single_small_dataset_golden_results(request): return get_cu_graph_and_params(*request.param) @@ -340,17 +354,24 @@ def single_small_dataset_nx_results(request): # results, the starting vertex for BFS, and flag if shortes path counting was # used. @pytest.fixture(scope="module", params=algo_test_fixture_params) -def dataset_nxresults_startvertex_spc(dataset_nx_results, request): - return get_cu_graph_nx_results_and_params(*request.param, *dataset_nx_results) +def dataset_goldenresults_startvertex_spc( + dataset_golden_results, load_traversal_results, request +): + return get_cu_graph_golden_results_and_params( + *request.param, *dataset_golden_results, load_traversal_results + ) @pytest.fixture(scope="module", params=single_algo_test_fixture_params) -def single_dataset_nxresults_startvertex_spc(single_small_dataset_nx_results, request): - return get_cu_graph_nx_results_and_params( - *request.param, *single_small_dataset_nx_results +def single_dataset_goldenresults_startvertex_spc( + single_small_dataset_golden_results, load_traversal_results, request +): + return get_cu_graph_golden_results_and_params( + *request.param, *single_small_dataset_golden_results, load_traversal_results ) +# FIXME: this is unused, remove? """@pytest.fixture(scope="module") def dataset_nxresults_allstartvertices_spc(small_dataset_nx_results): @@ -375,7 +396,7 @@ def dataset_nxresults_allstartvertices_spc(small_dataset_nx_results): # ============================================================================= @pytest.mark.sg @pytest.mark.parametrize("cugraph_input_type", utils.CUGRAPH_INPUT_TYPES) -def test_bfs(gpubenchmark, dataset_nxresults_startvertex_spc, cugraph_input_type): +def test_bfs(gpubenchmark, dataset_goldenresults_startvertex_spc, cugraph_input_type): """ Test BFS traversal on random source with distance and predecessors """ @@ -383,10 +404,10 @@ def test_bfs(gpubenchmark, dataset_nxresults_startvertex_spc, cugraph_input_type G, dataset, directed, - nx_values, + golden_values, start_vertex, depth_limit, - ) = dataset_nxresults_startvertex_spc + ) = dataset_goldenresults_startvertex_spc if directed: if isinstance(cugraph_input_type, cugraph.Graph): @@ -397,32 +418,34 @@ def test_bfs(gpubenchmark, dataset_nxresults_startvertex_spc, cugraph_input_type else: G_or_matrix = G - compare_bfs(gpubenchmark, G_or_matrix, nx_values, start_vertex, depth_limit) + compare_bfs(gpubenchmark, G_or_matrix, golden_values, start_vertex, depth_limit) @pytest.mark.sg @pytest.mark.parametrize("cugraph_input_type", utils.MATRIX_INPUT_TYPES) def test_bfs_nonnative_inputs_matrix( - gpubenchmark, single_dataset_nxresults_startvertex_spc, cugraph_input_type + gpubenchmark, single_dataset_goldenresults_startvertex_spc, cugraph_input_type ): - test_bfs(gpubenchmark, single_dataset_nxresults_startvertex_spc, cugraph_input_type) + test_bfs( + gpubenchmark, single_dataset_goldenresults_startvertex_spc, cugraph_input_type + ) @pytest.mark.sg def test_bfs_nonnative_inputs_nx( - single_dataset_nxresults_startvertex_spc, + single_dataset_goldenresults_startvertex_spc, ): ( _, _, directed, - nx_values, + golden_values, start_vertex, _, - ) = single_dataset_nxresults_startvertex_spc + ) = single_dataset_goldenresults_startvertex_spc cugraph_df = get_resultset( - category="traversal", + resultset_name="traversal", algo="bfs_edges", graph_dataset="karate", graph_directed=str(directed), @@ -430,13 +453,13 @@ def test_bfs_nonnative_inputs_nx( ) compare_func = _compare_bfs - compare_func(cugraph_df, nx_values, start_vertex) + compare_func(cugraph_df, golden_values, start_vertex) @pytest.mark.sg @pytest.mark.parametrize("cugraph_input_type", utils.CUGRAPH_INPUT_TYPES) -def test_bfs_invalid_start(dataset_nxresults_startvertex_spc, cugraph_input_type): - (G, _, _, _, start_vertex, depth_limit) = dataset_nxresults_startvertex_spc +def test_bfs_invalid_start(dataset_goldenresults_startvertex_spc, cugraph_input_type): + (G, _, _, _, start_vertex, depth_limit) = dataset_goldenresults_startvertex_spc el = G.view_edge_list() diff --git a/python/cugraph/cugraph/tests/traversal/test_paths.py b/python/cugraph/cugraph/tests/traversal/test_paths.py index a04fa9b0b0d..7f933ec5523 100644 --- a/python/cugraph/cugraph/tests/traversal/test_paths.py +++ b/python/cugraph/cugraph/tests/traversal/test_paths.py @@ -21,7 +21,7 @@ import cudf import cupy import cugraph -from cugraph.testing import get_resultset +from cugraph.testing import get_resultset, load_resultset from cupyx.scipy.sparse import coo_matrix as cupy_coo_matrix @@ -39,21 +39,22 @@ paths_test_data = { - "nx.shortest_path_length_1_1": 0, - # "cu.shortest_path_length_1_1": 0.0, - "nx.shortest_path_length_1_5": 2.0, - # "cu.shortest_path_length_1_5": 2.0, - "nx.shortest_path_length_1_3": 2.0, - # "cu.shortest_path_length_1_3": 2.0, - "nx.shortest_path_length_1_6": 2.0, - # "cu.shortest_path_length_1_6": 2.0, - "cu.shortest_path_length_nx_-1_1": ValueError, - "cu.shortest_path_length_nx_1_10": ValueError, - "cu.shortest_path_length_nx_0_42": ValueError, - "cu.shortest_path_length_nx_1_8": 3.4028235e38, + "shortest_path_length_1_1": 0, + "shortest_path_length_1_5": 2.0, + "shortest_path_length_1_3": 2.0, + "shortest_path_length_1_6": 2.0, + "shortest_path_length_nx_-1_1": ValueError, + "shortest_path_length_nx_1_10": ValueError, + "shortest_path_length_nx_0_42": ValueError, + "shortest_path_length_nx_1_8": 3.4028235e38, } +@pytest.fixture(scope="module") +def load_traversal_results(): + return load_resultset("traversal", None) + + @pytest.fixture def graphs(request): with NamedTemporaryFile(mode="w+", suffix=".csv") as graph_tf: @@ -99,27 +100,24 @@ def test_connected_graph_shortest_path_length(graphs): cugraph_G, cupy_df = graphs path_1_to_1_length = cugraph.shortest_path_length(cugraph_G, 1, 1) + # FIXME: aren't the first two assertions in each batch essentially redundant? assert path_1_to_1_length == 0.0 - assert path_1_to_1_length == paths_test_data["nx.shortest_path_length_1_1"] - # assert path_1_to_1_length == paths_test_data["cu.shortest_path_length_1_1"] + assert path_1_to_1_length == paths_test_data["shortest_path_length_1_1"] assert path_1_to_1_length == cugraph.shortest_path_length(cupy_df, 1, 1) path_1_to_5_length = cugraph.shortest_path_length(cugraph_G, 1, 5) assert path_1_to_5_length == 2.0 - assert path_1_to_5_length == paths_test_data["nx.shortest_path_length_1_5"] - # assert path_1_to_5_length == paths_test_data["cu.shortest_path_length_1_5"] + assert path_1_to_5_length == paths_test_data["shortest_path_length_1_5"] assert path_1_to_5_length == cugraph.shortest_path_length(cupy_df, 1, 5) path_1_to_3_length = cugraph.shortest_path_length(cugraph_G, 1, 3) assert path_1_to_3_length == 2.0 - assert path_1_to_3_length == paths_test_data["nx.shortest_path_length_1_3"] - # assert path_1_to_3_length == paths_test_data["cu.shortest_path_length_1_3"] + assert path_1_to_3_length == paths_test_data["shortest_path_length_1_3"] assert path_1_to_3_length == cugraph.shortest_path_length(cupy_df, 1, 3) path_1_to_6_length = cugraph.shortest_path_length(cugraph_G, 1, 6) assert path_1_to_6_length == 2.0 - assert path_1_to_6_length == paths_test_data["nx.shortest_path_length_1_6"] - # assert path_1_to_6_length == paths_test_data["cu.shortest_path_length_1_6"] + assert path_1_to_6_length == paths_test_data["shortest_path_length_1_6"] assert path_1_to_6_length == cugraph.shortest_path_length(cupy_df, 1, 6) @@ -131,7 +129,7 @@ def test_shortest_path_length_invalid_source(graphs): with pytest.raises(ValueError): cugraph.shortest_path_length(cugraph_G, -1, 1) - result = paths_test_data["cu.shortest_path_length_nx_-1_1"] + result = paths_test_data["shortest_path_length_nx_-1_1"] if callable(result): with pytest.raises(ValueError): raise result() @@ -148,7 +146,7 @@ def test_shortest_path_length_invalid_target(graphs): with pytest.raises(ValueError): cugraph.shortest_path_length(cugraph_G, 1, 10) - result = paths_test_data["cu.shortest_path_length_nx_1_10"] + result = paths_test_data["shortest_path_length_nx_1_10"] if callable(result): with pytest.raises(ValueError): raise result() @@ -165,7 +163,7 @@ def test_shortest_path_length_invalid_vertexes(graphs): with pytest.raises(ValueError): cugraph.shortest_path_length(cugraph_G, 0, 42) - result = paths_test_data["cu.shortest_path_length_nx_0_42"] + result = paths_test_data["shortest_path_length_nx_0_42"] if callable(result): with pytest.raises(ValueError): raise result() @@ -186,7 +184,7 @@ def test_shortest_path_length_no_path(graphs): path_1_to_8 = cugraph.shortest_path_length(cugraph_G, 1, 8) assert path_1_to_8 == sys.float_info.max - nx_path_1_to_8 = paths_test_data["cu.shortest_path_length_nx_1_8"] + nx_path_1_to_8 = paths_test_data["shortest_path_length_nx_1_8"] nx_path_1_to_8 = np.float32(nx_path_1_to_8) assert nx_path_1_to_8 in [ max_float_32, @@ -197,18 +195,26 @@ def test_shortest_path_length_no_path(graphs): @pytest.mark.sg @pytest.mark.parametrize("graphs", [DISCONNECTED_GRAPH], indirect=True) -def test_shortest_path_length_no_target(graphs): +def test_shortest_path_length_no_target(graphs, load_traversal_results): cugraph_G, cupy_df = graphs cugraph_path_1_to_all = cugraph.shortest_path_length(cugraph_G, 1) nx_path_1_to_all = get_resultset( - category="traversal", + resultset_name="traversal", algo="shortest_path_length", graph_dataset="DISCONNECTED", graph_directed=str(True), source="1", weight="weight", ) + """nx_path_1_to_all = get_resultset( + category="traversal", + algo="shortest_path_length", + graph_dataset="DISCONNECTED", + graph_directed=str(True), + source="1", + weight="weight", + )""" cupy_path_1_to_all = cugraph.shortest_path_length(cupy_df, 1) # Cast networkx graph on cugraph vertex column type from str to int. diff --git a/python/cugraph/cugraph/tests/traversal/test_sssp.py b/python/cugraph/cugraph/tests/traversal/test_sssp.py index d948227d651..0d0f8f60769 100644 --- a/python/cugraph/cugraph/tests/traversal/test_sssp.py +++ b/python/cugraph/cugraph/tests/traversal/test_sssp.py @@ -28,7 +28,13 @@ from scipy.sparse import csr_matrix as sp_csr_matrix from scipy.sparse import csc_matrix as sp_csc_matrix from pylibcugraph.testing.utils import gen_fixture_params_product -from cugraph.testing import utils, get_resultset, UNDIRECTED_DATASETS, SMALL_DATASETS +from cugraph.testing import ( + utils, + get_resultset, + load_resultset, + UNDIRECTED_DATASETS, + SMALL_DATASETS, +) # Map of cuGraph input types to the expected output type for cuGraph @@ -121,7 +127,7 @@ def cugraph_call(gpu_benchmark_callable, input_G_or_matrix, source, edgevals=Tru return result_dict, max_val -def networkx_call(graph_file, source, edgevals=True): +def networkx_call(graph_file, source, load_results, edgevals=True): dataset_path = graph_file.get_path() dataset_name = graph_file.metadata["name"] @@ -129,7 +135,7 @@ def networkx_call(graph_file, source, edgevals=True): # FIXME: no test coverage if edgevals is False, this assertion is never reached assert False nx_paths = get_resultset( - category="traversal", + resultset_name="traversal", algo="single_source_shortest_path_length", graph_dataset=dataset_name, graph_directed=str(True), @@ -140,13 +146,12 @@ def networkx_call(graph_file, source, edgevals=True): # not support 'weights'. It matches cuGraph result only if the weight column # is 1s. nx_paths = get_resultset( - category="traversal", + resultset_name="traversal", algo="single_source_dijkstra_path_length", graph_dataset=dataset_name, graph_directed=str(True), source=str(source), ) - # nx_paths = nx_paths.drop(columns="Unnamed: 0") nx_paths = cudf.Series(nx_paths.distance.values, index=nx_paths.vertex).to_dict() G = graph_file.get_graph( @@ -178,26 +183,31 @@ def networkx_call(graph_file, source, edgevals=True): # These fixtures will call networkx BFS algos and save the result. The networkx # call is only made only once per input param combination. +@pytest.fixture(scope="module") +def load_traversal_results(): + return load_resultset("traversal", None) + + @pytest.fixture(scope="module", params=fixture_params) def dataset_source_nxresults(request): # request.param is a tuple of params from fixture_params. When expanded # with *, will be passed to networkx_call() as args (graph_file, source) - return networkx_call(*(request.param)) + return networkx_call(*(request.param), load_traversal_results) @pytest.fixture(scope="module", params=fixture_params_single_dataset) def single_dataset_source_nxresults(request): - return networkx_call(*(request.param)) + return networkx_call(*(request.param), load_traversal_results) @pytest.fixture(scope="module", params=fixture_params) def dataset_source_nxresults_weighted(request): - return networkx_call(*(request.param), edgevals=True) + return networkx_call(*(request.param), load_traversal_results, edgevals=True) @pytest.fixture(scope="module", params=fixture_params_single_dataset) def single_dataset_source_nxresults_weighted(request): - return networkx_call(*(request.param), edgevals=True) + return networkx_call(*(request.param), load_traversal_results, edgevals=True) # ============================================================================= @@ -265,7 +275,7 @@ def test_sssp_nonnative_inputs_nx(single_dataset_source_nxresults, directed): (_, _, graph_file, source, nx_paths) = single_dataset_source_nxresults dataset_name = graph_file.metadata["name"] result = get_resultset( - category="traversal", + resultset_name="traversal", algo="sssp_nonnative", graph_dataset=dataset_name, graph_directed=str(directed), @@ -369,7 +379,7 @@ def test_sssp_data_type_conversion(graph_file, source): pred_np = df["predecessor"].to_numpy() cu_paths = dict(zip(verts_np, zip(dist_np, pred_np))) nx_paths = get_resultset( - category="traversal", + resultset_name="traversal", algo="single_source_dijkstra_path_length", graph_dataset=dataset_name, graph_directed=str(True), @@ -403,10 +413,13 @@ def test_sssp_data_type_conversion(graph_file, source): @pytest.mark.sg -def test_sssp_networkx_edge_attr(): +def test_sssp_networkx_edge_attr(load_traversal_results): df = get_resultset( - category="traversal", algo="sssp_nonnative", test="network_edge_attr" + resultset_name="traversal", algo="sssp_nonnative", test="network_edge_attr" ) + """df = get_resultset( + category="traversal", algo="sssp_nonnative", test="network_edge_attr" + )""" df = df.set_index("vertex") assert df.loc[0, "distance"] == 0 assert df.loc[1, "distance"] == 10