From 55a798fe39ebbda60adfb3528d7ddf6c926e1ad6 Mon Sep 17 00:00:00 2001 From: wang Date: Mon, 26 Jun 2023 11:41:46 +0800 Subject: [PATCH 1/6] Explicit error message for SSSP run over a graph with no edge weight Signed-off-by: wang --- python/graphscope/analytical/app/sssp.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index 6012ee76550d..45288afd8197 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -19,6 +19,7 @@ from graphscope.framework.app import AppAssets from graphscope.framework.app import not_compatible_for from graphscope.framework.app import project_to_simple +from graphscope.proto import graph_def_pb2 __all__ = [ "sssp", @@ -59,4 +60,12 @@ def sssp(graph, src=0, weight=None): >>> c = graphscope.sssp(pg, src=6) >>> sess.close() """ + if graph.schema.edata_type == graph_def_pb2.NULLVALUE: + raise RuntimeError( + "The edge data is empty, and the edge data type should be integers or floating point numbers to run SSSP." + ) + if graph.schema.edata_type == graph_def_pb2.STRING: + raise RuntimeError( + "The edge data type is string, and the edge data type should be integers or floating point numbers to run SSSP." + ) return AppAssets(algo="sssp", context="vertex_data")(graph, src) From de98a0ac93b67686054c1d8f4a5e081fef838028 Mon Sep 17 00:00:00 2001 From: wang Date: Mon, 26 Jun 2023 14:32:04 +0800 Subject: [PATCH 2/6] pass ci --- python/graphscope/analytical/app/sssp.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index 45288afd8197..a8efd6edf834 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -19,6 +19,7 @@ from graphscope.framework.app import AppAssets from graphscope.framework.app import not_compatible_for from graphscope.framework.app import project_to_simple +from graphscope.framework.graph import GraphDAGNode from graphscope.proto import graph_def_pb2 __all__ = [ @@ -60,12 +61,13 @@ def sssp(graph, src=0, weight=None): >>> c = graphscope.sssp(pg, src=6) >>> sess.close() """ - if graph.schema.edata_type == graph_def_pb2.NULLVALUE: - raise RuntimeError( - "The edge data is empty, and the edge data type should be integers or floating point numbers to run SSSP." - ) - if graph.schema.edata_type == graph_def_pb2.STRING: - raise RuntimeError( - "The edge data type is string, and the edge data type should be integers or floating point numbers to run SSSP." - ) + if not isinstance(graph, GraphDAGNode): + if graph.schema.edata_type == graph_def_pb2.NULLVALUE: + raise RuntimeError( + "The edge data is empty, and the edge data type should be integers or floating point numbers to run SSSP." + ) + if graph.schema.edata_type == graph_def_pb2.STRING: + raise RuntimeError( + "The edge data type is string, and the edge data type should be integers or floating point numbers to run SSSP." + ) return AppAssets(algo="sssp", context="vertex_data")(graph, src) From 11790e0c7f45107348f02dce548cbc2b57629e0e Mon Sep 17 00:00:00 2001 From: wang Date: Mon, 26 Jun 2023 14:54:11 +0800 Subject: [PATCH 3/6] format code --- python/graphscope/analytical/app/sssp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index a8efd6edf834..796fb15c608a 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -64,10 +64,12 @@ def sssp(graph, src=0, weight=None): if not isinstance(graph, GraphDAGNode): if graph.schema.edata_type == graph_def_pb2.NULLVALUE: raise RuntimeError( - "The edge data is empty, and the edge data type should be integers or floating point numbers to run SSSP." + "The edge data is empty, and the edge data type should be"\ + + " integers or floating point numbers to run SSSP." ) if graph.schema.edata_type == graph_def_pb2.STRING: raise RuntimeError( - "The edge data type is string, and the edge data type should be integers or floating point numbers to run SSSP." + "The edge data type is string, and the edge data type should be"\ + + " integers or floating point numbers to run SSSP." ) return AppAssets(algo="sssp", context="vertex_data")(graph, src) From d46f53a5466fd82bc97266a6658c58be761c10aa Mon Sep 17 00:00:00 2001 From: wang Date: Mon, 26 Jun 2023 14:57:16 +0800 Subject: [PATCH 4/6] format code --- python/graphscope/analytical/app/sssp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index 796fb15c608a..3e6796fab6a4 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -65,11 +65,11 @@ def sssp(graph, src=0, weight=None): if graph.schema.edata_type == graph_def_pb2.NULLVALUE: raise RuntimeError( "The edge data is empty, and the edge data type should be"\ - + " integers or floating point numbers to run SSSP." + " integers or floating point numbers to run SSSP." ) if graph.schema.edata_type == graph_def_pb2.STRING: raise RuntimeError( "The edge data type is string, and the edge data type should be"\ - + " integers or floating point numbers to run SSSP." + " integers or floating point numbers to run SSSP." ) return AppAssets(algo="sssp", context="vertex_data")(graph, src) From 9a432201ae72f7712158ea1afeb1086822b826f6 Mon Sep 17 00:00:00 2001 From: wang Date: Mon, 26 Jun 2023 14:59:48 +0800 Subject: [PATCH 5/6] code format Signed-off-by: wang --- python/graphscope/analytical/app/sssp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index 3e6796fab6a4..d6c595902155 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -64,12 +64,12 @@ def sssp(graph, src=0, weight=None): if not isinstance(graph, GraphDAGNode): if graph.schema.edata_type == graph_def_pb2.NULLVALUE: raise RuntimeError( - "The edge data is empty, and the edge data type should be"\ + "The edge data is empty, and the edge data type should be" " integers or floating point numbers to run SSSP." ) if graph.schema.edata_type == graph_def_pb2.STRING: raise RuntimeError( - "The edge data type is string, and the edge data type should be"\ + "The edge data type is string, and the edge data type should be" " integers or floating point numbers to run SSSP." ) return AppAssets(algo="sssp", context="vertex_data")(graph, src) From fa94a9ab6bfe3a402589f01c22e01394296f5aee Mon Sep 17 00:00:00 2001 From: wang Date: Tue, 27 Jun 2023 10:05:32 +0800 Subject: [PATCH 6/6] update error message Signed-off-by: wang --- python/graphscope/analytical/app/sssp.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index d6c595902155..41ff686b38e9 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -64,12 +64,12 @@ def sssp(graph, src=0, weight=None): if not isinstance(graph, GraphDAGNode): if graph.schema.edata_type == graph_def_pb2.NULLVALUE: raise RuntimeError( - "The edge data is empty, and the edge data type should be" - " integers or floating point numbers to run SSSP." + "The edge data is empty, and the edge data type should be integers or " + "floating point numbers to run SSSP. Suggest to use bfs() algorithm." ) if graph.schema.edata_type == graph_def_pb2.STRING: raise RuntimeError( - "The edge data type is string, and the edge data type should be" - " integers or floating point numbers to run SSSP." + "The edge data type is string, and the edge data type should be " + "integers or floating point numbers to run SSSP." ) return AppAssets(algo="sssp", context="vertex_data")(graph, src)