Skip to main content
URL: http://<db.host>:<db.port>/solve/graph
Solves an existing graph for a type of problem (e.g., shortest path, page rank, traveling salesman, etc.) using source nodes, destination nodes, and additional, optional weights and restrictions. IMPORTANT: It’s highly recommended that you review the Graphs and Solvers concepts documentation, the Graph REST Tutorial, and/or some /solve/graph examples before using this endpoint.

Input Parameter Description

graph_name
string
Name of the graph resource to solve.
weights_on_edges
array of strings
Additional weights to apply to the edges of an existing graph. Weights must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., ‘table.column AS WEIGHTS_EDGE_ID’, expressions, e.g., ‘ST_LENGTH(wkt) AS WEIGHTS_VALUESPECIFIED’, or constant values, e.g., ‘{4, 15, 2} AS WEIGHTS_VALUESPECIFIED’. Any provided weights will be added (in the case of ‘WEIGHTS_VALUESPECIFIED’) to or multiplied with (in the case of ‘WEIGHTS_FACTORSPECIFIED’) the existing weight(s). If using constant values in an identifier combination, the number of values specified must match across the combination.The default value is an empty array ( [] ).
restrictions
array of strings
Additional restrictions to apply to the nodes/edges of an existing graph. Restrictions must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., ‘table.column AS RESTRICTIONS_EDGE_ID’, expressions, e.g., ‘column/2 AS RESTRICTIONS_VALUECOMPARED’, or constant values, e.g., ‘{0, 0, 0, 1} AS RESTRICTIONS_ONOFFCOMPARED’. If using constant values in an identifier combination, the number of values specified must match across the combination. If remove_previous_restrictions option is set to true, any provided restrictions will replace the existing restrictions. Otherwise, any provided restrictions will be added (in the case of ‘RESTRICTIONS_VALUECOMPARED’) to or replaced (in the case of ‘RESTRICTIONS_ONOFFCOMPARED’).The default value is an empty array ( [] ).
solver_type
string
The type of solver to use for the graph.The default value is SHORTEST_PATH.
  • SHORTEST_PATH: Solves for the optimal (shortest) path based on weights and restrictions from one source to destinations nodes. Also known as the Dijkstra solver.
  • PAGE_RANK: Solves for the probability of each destination node being visited based on the links of the graph topology. Weights are not required to use this solver.
  • PROBABILITY_RANK: Solves for the transitional probability (Hidden Markov) for each node based on the weights (probability assigned over given edges).
  • CENTRALITY: Solves for the degree of a node to depict how many pairs of individuals that would have to go through the node to reach one another in the minimum number of hops. Also known as betweenness.
  • MULTIPLE_ROUTING: Solves for finding the minimum cost cumulative path for a round-trip starting from the given source and visiting each given destination node once then returning to the source. Also known as the traveling salesman problem.
  • INVERSE_SHORTEST_PATH: Solves for finding the optimal path cost for each destination node to route to the source node. Also known as inverse Dijkstra or the service man routing problem.
  • BACKHAUL_ROUTING: Solves for optimal routes that connect remote asset nodes to the fixed (backbone) asset nodes.
  • ALLPATHS: Solves for paths that would give costs between max and min solution radia - Make sure to limit by the ‘max_solution_targets’ option. Min cost should be >= shortest_path cost.
  • STATS_ALL: Solves for graph statistics such as graph diameter, longest pairs, vertex valences, topology numbers, average and max cluster sizes, etc.
  • CLOSENESS: Solves for the centrality closeness score per node as the sum of the inverse shortest path costs to all nodes in the graph.
source_nodes
array of strings
It can be one of the nodal identifiers - e.g: ‘NODE_WKTPOINT’ for source nodes. For BACKHAUL_ROUTING, this list depicts the fixed assets.The default value is an empty array ( [] ).
destination_nodes
array of strings
It can be one of the nodal identifiers - e.g: ‘NODE_WKTPOINT’ for destination (target) nodes. For BACKHAUL_ROUTING, this list depicts the remote assets.The default value is an empty array ( [] ).
solution_table
string
Name of the table to store the solution, in [schema_name.]table_name format, using standard name resolution rules.The default value is graph_solutions.
options
map of string to strings
Additional parameters.The default value is an empty map ( {} ).

Output Parameter Description

The Kinetica server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:
status
String
‘OK’ or ‘ERROR’
message
String
Empty if success or an error message
data_type
String
‘solve_graph_response’ or ‘none’ in case of an error
data
String
Empty string
data_str
JSON or String
This embedded JSON represents the result of the /solve/graph endpoint:Empty string in case of an error.