Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of: uppercase, lowercase, numbers, and special characters.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

The MAC address of the server you want to deploy.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Applied Validity Period(days)
Effective Date
Excpired Date
Mac Address
Apply Comment
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
  • Country:
  • Language:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.0
Search
    English
    v5.0

      Delta-Stepping Single-Source Shortest Path

      HDC

      Overview

      The single-source shortest path (SSSP) problem is that of computing, for each node that is reachable from the source node, the shortest path with the minimum total edge weights among all possible paths; or in the case of unweighted graphs, the shortest path with the minimum number of edges. The cost (or distance) of the shortest path is the total edge weights or the number of edges.

      The Delta-Stepping algorithm can be viewed as a variant of Dijkstra's algorithm with its potential for parallelism.

      Related material of the algorithm:

      Concepts

      Delta-Stepping Single-Source Shortest Path

      The Delta-Stepping Single-Source Shortest Path (SSSP) algorithm introduces the concept of "buckets" and performs relaxation operations in a more coarse-grained manner. The algorithm utilizes a positive real number parameter delta (Δ) to achieve the following:

      • Maintain an array B of buckets such that B[i] contains nodes whose distance falls within the range [iΔ, (i+1)Δ). Thus Δ is also called the "step width" or "bucket width".
      • Distinguish between light edges with weight ≤ Δ and heavy edges with weight > Δ in the graph. Light-edge nodes are prioritized during relaxation as they have lower weights and are more likely to yield shorter paths.

      The term relaxation refers to the process of updating the distance of a node v that is connected to node u to a potential shorter distance by considering the path through node u. Specifically, the distance of node v is updated to dist(v) = dist(u) + w(u,v), where w(u,v) is the weight of the edge (u,v). This update is performed only if the current dist(v) is greater than dist(u) + w(u,v).

      In the Delta-Stepping SSSP algorithm, the relaxation also includes assigning the relaxed node to the corresponding bucket based on its updated distance value.

      Below is the description of the basic Delta-Stepping SSSP algorithm, along with an example to compute the weighted shortest paths in an undirected graph starting from the source node b, and Δ is set to 3:

      1. At the begining of the algorithm, all nodes have the distance as infinity except for the source node as 0. The source node is assigned to bucket B[0].

      2. In each iteration, remove all nodes from the first nonempty bucket B[i]:

      • Relax all light-edge neighbors of the removed nodes, the relaxed nodes might be assigned to B[i] or B[i+1]; defer the relaxation of the heavy-edge neighbors.
      • If B[i] is refilled, repeat the above operation until B[i] is empty.
      • Relax all deferred heavy-edge neighbors.
      Remove node b from B[0]:
      Relax light-edge neighbors a with dist(a) = min(0+2,∞) = 2, and d with dist(b) = min(0+3,∞) = 3.

      Remove node a from B[0]:
      Light-edge neighbor b cannot be relaxed.
      Relax heavy-edge neighbor c with dist(c) = min(0+5,∞) = 5, d cannot be relaxed.

      3. Repeat step 2 until all buckets are empty.

      Remove nodes d and c from B[1]:
      Relax light-edge neighbor g with dist(g) = min(5+2,∞) = 7, b, c and d cannot be relaxed.
      Relax heavy-edge neighbor e with dist(e) = min(5+4,∞) = 9, a and b cannot be relaxed.

      Remove node g from B[2]:
      Light-edge neighbor c cannot be relaxed.
      Relax heavy-edge neighbor f with dist(f) = min(7+5,∞) = 12.

      Remove node e from B[3]:
      Relax light-edge neighbor f with dist(f) = min(9+1,12) = 10.

      Remove node f from B[3]:
      Light-edge neighbor e cannot be relaxed.
      Heavy-edge neighbor g cannot be relaxed.
      The algorithm ends here since all buckets are empty.

      By dividing the nodes into buckets and processing them in parallel, the Delta-Stepping algorithm can exploit the available computational resources more efficiently, making it suitable for large-scale graphs and parallel computing environments.

      Considerations

      • The Delta-Stepping SSSP algorithm is only applicable to graphs with non-negative edge weights. If negative weights are present, the Delta-Stepping SSSP algorithm might produce false results. In this case, a different algorithm like the SPFA should be used.
      • If there are multiple shortest paths exist between two nodes, all of them will be found.
      • In disconnected graphs, the algorithm only outputs the shortest paths from the source node to all nodes belonging to the same connected component as the source node.

      Example Graph

      To create this graph:

      // Runs each row separately in order in an empty graphset
      create().edge_property(@default, "value", int32)
      insert().into(@default).nodes([{_id:"A"}, {_id:"B"}, {_id:"C"}, {_id:"D"}, {_id:"E"}, {_id:"F"}, {_id:"G"}])
      insert().into(@default).edges([{_from:"A", _to:"B", value:2}, {_from:"A", _to:"F", value:4}, {_from:"B", _to:"F", value:6}, {_from:"B", _to:"C", value:3}, {_from:"B", _to:"D", value:3}, {_from:"D", _to:"F", value:2}, {_from:"F", _to:"E", value:1}, {_from:"D", _to:"E", value:2}, {_from:"E", _to:"G", value:3}])
      

      Creating HDC Graph

      To load the entire graph to the HDC server hdc-server-1 as hdc_sssp:

      CALL hdc.graph.create("hdc-server-1", "hdc_sssp", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      })
      

      hdc.graph.create("hdc_sssp", {
        nodes: {"*": ["*"]},
        edges: {"*": ["*"]},
        direction: "undirected",
        load_id: true,
        update: "static",
        query: "query",
        default: false
      }).to("hdc-server-1")
      

      Parameters

      Algorithm name: sssp

      Name
      Type
      Spec
      Default
      Optional
      Description
      ids _id / / No Specifies a single source node by its _id.
      uuids _uuid / / No Specifies a single source node by its _uuid.
      direction String in, out / Yes Specifies that the shortest paths should only contain incoming edges (in) or outgoing edges (out); edge direction is ignored if it is unset.
      edge_schema_property []"<@schema.?><property>" / / Yes Numeric edge properties used as weights, summing values across the specified properties; edges without this property are ignored.
      record_path Integer 0, 1 0 Yes Whether to include the shortest paths in the results; sets to 1 to return the totalCost and the shortest paths, or to 0 to return the totalCost only.
      impl_type String delta_stepping beta No Specifies the implementation type of the SSSP algorithm; for the Delta-Stepping SSSP, keep it as delta_stepping; beta is Ultipa's default shortest path algorithm.
      delta Float >0 2 Yes The value of delta; only valid when impl_type is set to delta_stepping.
      return_id_uuid String uuid, id, both uuid Yes Includes _uuid, _id, or both to represent nodes in the results. Edges can only be represented by _uuid.
      limit Integer ≥-1 -1 Yes Limits the number of results returned; -1 includes all results.
      order String asc, desc / Yes Sorts the results by totalCost.

      File Writeback

      CALL algo.sssp.write("hdc_sssp", {
        params: {
          ids: "A",
          edge_schema_property: "@default.value",
          impl_type: "delta_stepping",
          return_id_uuid: "id"
        },
        return_params: {
          file: {
            filename: "costs"
          }
        }
      })
      

      algo(sssp).params({
        project: "hdc_sssp",
        ids: "A",
        edge_schema_property: "@default.value",
        impl_type: "delta_stepping",
        return_id_uuid: "id"
      }).write({
        file: {
            filename: "costs"
        }
      })
      

      Result:

      _id,totalCost
      G,8
      D,5
      F,4
      B,2
      E,5
      C,5
      

      CALL algo.sssp.write("hdc_sssp", {
        params: {
          ids: "A",
          edge_schema_property: '@default.value',
          impl_type: 'delta_stepping',
          delta: 2,
          record_path: 1,
          return_id_uuid: "id"
        },
        return_params: {
          file: {
            filename: "paths"
          }
        }
      })
      

      algo(sssp).params({
        project: "hdc_sssp",
        ids: "A",
        edge_schema_property: '@default.value',
        impl_type: 'delta_stepping',
        delta: 2,
        record_path: 1,
        return_id_uuid: "id"
      }).write({
        file: {
            filename: "paths"
        }
      })
      

      Result:

      totalCost,_ids
      8,A--[102]--F--[107]--E--[109]--G
      5,A--[101]--B--[105]--D
      5,A--[102]--F--[107]--E
      5,A--[103]--B--[104]--C
      4,A--[102]--F
      2,A--[101]--B
      

      Full Return

      CALL algo.sssp("hdc_sssp", {
        params: {
          ids: 'A',
          edge_schema_property: 'value',
          impl_type: 'delta_stepping',
          delta: 3,
          record_path: 0,
          return_id_uuid: 'id',
          order: 'desc'
        },
        return_params: {}
      }) YIELD r
      RETURN r
      

      exec{
        algo(sssp).params({
          ids: 'A',
          edge_schema_property: 'value',
          impl_type: 'delta_stepping',
          delta: 3,
          record_path: 0,
          return_id_uuid: 'id',
          order: 'desc'
        }) as r
        return r
      } on hdc_sssp
      

      Result:

      _id totalCost
      G 8
      D 5
      E 5
      C 5
      F 4
      B 2

      Stream Return

      CALL algo.sssp("hdc_sssp", {
        params: {
          ids: 'A',
          edge_schema_property: '@default.value',
          impl_type: 'delta_stepping',
          record_path: 1,
          return_id_uuid: 'id'
        },
        return_params: {
          stream: {}
        }
      }) YIELD r
      RETURN r
      

      exec{
        algo(sssp).params({
          ids: 'A',
          edge_schema_property: '@default.value',
          impl_type: 'delta_stepping',
          record_path: 1,
          return_id_uuid: 'id'
        }).stream() as r
        return r
      } on hdc_sssp
      

      Result:

      totalCost
      _ids
      8 ["A","102","F","107","E","109","G"]
      5 ["A","101","B","105","D"]
      5 ["A","102","F","107","E"]
      5 ["A","101","B","104","C"]
      4 ["A","102","F"]
      2 ["A","101","B"]
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写