Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show explicit error message for SSSP run over a graph with no edge weight #2929

Merged
merged 6 commits into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions python/graphscope/analytical/app/sssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)