diff --git a/python/graphscope/analytical/app/sssp.py b/python/graphscope/analytical/app/sssp.py index 6012ee76550d..41ff686b38e9 100644 --- a/python/graphscope/analytical/app/sssp.py +++ b/python/graphscope/analytical/app/sssp.py @@ -19,6 +19,8 @@ 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__ = [ "sssp", @@ -59,4 +61,15 @@ def sssp(graph, src=0, weight=None): >>> c = graphscope.sssp(pg, src=6) >>> sess.close() """ + 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. 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." + ) return AppAssets(algo="sssp", context="vertex_data")(graph, src)