Skip to main content
Solves an existing graph using one of the supported solver types. The SOLVE GRAPH function can be called either within a SELECT statement as a table function or within an EXECUTE FUNCTION call.

Parameters

GRAPH

Name of the graph to solve

SOLVER_TYPE

The type of solver to use for the operation.
SolverDescriptionCPU Parallel
ALLPATHSDetermines all reasonable paths between a source and destination pair.X
BACKHAUL_ROUTINGDetermines the optimal routes between remote asset nodes and fixed asset nodes.X
CENTRALITYCalculates 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.X
CLOSENESSCalculates the centrality closeness score per node as the sum of the inverse shortest path costs to all nodes in the graph.X
INVERSE_SHORTEST_PATHDetermines the shortest path downstream using multiple technician routing.X
MULTIPLE_ROUTINGCalculates the shortest possible route between the nodes and returns to the origin node — also known as the traveling salesman.X
PAGE_RANKCalculates how connected the nodes are and determines which nodes are the most important. Weights are not required.X
PROBABILITY_RANKCalculates the probability of a node being connected to another node using hidden Markov chains.X
SHORTEST_PATHDetermines the shortest path upstream between given source(s) and destination(s).X
STATS_ALLCalculates graph statistics such as graph diameter, longest pairs, vertex valences, topology numbers, average and max cluster sizes, etc.X

SOURCE_NODES

The node(s) used as the origin point(s) for the solution specified using the SQL INPUT_TABLE or INPUT_TABLES function.
The input can be either the name of a table with appropriately named columns; or a query, to use specific columns or other SQL features).

SOLUTION_TABLE

Only applicable when using EXECUTE FUNCTION syntax. Name of the table to store the solution in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria

DESTINATION_NODES

The node(s) used as the destination point(s) for the solution specified using the SQL INPUT_TABLE or INPUT_TABLES function.
The input can be either the name of a table with appropriately named columns; or a query, to use specific columns or other SQL features).

WEIGHTS_ON_EDGES

Additional weights to apply to the edges of an existing graph specified using the SQL INPUT_TABLE or INPUT_TABLES function; review Components and Identifiers and Identifier Combinations for more information.
The input can be either the name of a table with appropriately named columns; or a query, to use specific columns or other SQL features).

RESTRICTIONS

Additional restrictions to apply to the nodes/edges of an existing graph specified using the SQL INPUT_TABLE or INPUT_TABLES function; review Components and Identifiers and Identifier Combinations for more information.
The input can be either the name of a table with appropriately named columns; or a query, to use specific columns or other SQL features).

OPTIONS

Optional indicator that a comma-delimited list of connection option/value assignments will follow.
OptionDescription
astar_radiusFor SHORTEST_PATH, INVERSE_SHORTEST_PATH, ALLPATHS, and MULTIPLE_ROUTING solvers, when solve_heuristic is astar. The shortest path traversal front includes nodes only within this radius (kilometers) as it moves towards the target location. Default is 70.
convergence_limitFor PAGE_RANK solver only; maximum percent relative threshold on the pagerank scores of each node between consecutive iterations to satisfy convergence. Default value is 1%.
intersection_penaltyThis will add an additional weight over the edges labeled as intersection if the add_turn option was invoked during graph creation. The default value is 0.0.
left_turn_penaltyThis will add an additional weight over the edges labeled as left_turn if the add_turn option was invoked during graph creation. The default value is 0.0.
max_iterationsFor PAGE_RANK solver only; maximum number of pagerank iterations for satisfying convergence. Default value is 100.
max_num_combinationsFor MULTIPLE_ROUTING solver only. Sets the cap on the combinatorial sequence generated. If the default value (2000000) is overridden, it potentially speeds up the solver.
max_runsFor CENTRALITY solver only. Sets the maximum number of shortest path runs—maximum possible value is the number of nodes in the graph. Default of 0 enables this value to be auto-computed by the solver.
max_solution_radiusFor SHORTEST_PATH, INVERSE_SHORTEST_PATH, & ALLPATHS solvers only. Sets the maximum solution cost radius, which ignores the DESTINATION_NODES list and instead outputs the nodes within the radius sorted by ascending cost. If set to 0.0 (the default), the setting is ignored.
max_solution_targetsFor SHORTEST_PATH, INVERSE_SHORTEST_PATH, & ALLPATHS solvers only. Sets the maximum number of solution targets, which ignores the DESTINATION_NODES list and instead outputs no more than n number of nodes sorted by ascending cost where n is equal to the setting value. If set to 0 (the default), the setting is ignored.
min_solution_radiusFor SHORTEST_PATH, INVERSE_SHORTEST_PATH, & ALLPATHS solvers only. Applicable when max_solution_radius is set. Sets the minimum solution cost radius, which ignores the DESTINATION_NODES list and instead outputs the nodes within the radius sorted by ascending cost. If set to 0.0 (the default), the setting is ignored.
num_best_pathsFor MULTIPLE_ROUTING solver only. Sets the number of shortest paths computed from each node. This is the heuristic criterion. If set to 0 (the default), the number will be determined automatically by the solver. Users may want to override this parameter to speed up the solver.
output_clustersFor STATS_ALL solver only; the cluster index for each node will be inserted as an additional column in the output.
output_edge_pathIf set to true, concatenated edge IDs will be added as an EDGE_PATH column to the solution table for each source and target pair in the SHORTEST_PATH solves. The default value is false
output_wkt_pathIf set to true, WKT line segments will be added as a WKTROUTE column to the solution table for each source and target pair in SHORTEST_PATH solves. The default value is false.
right_turn_penaltyThis will add an additional weight over the edges labeled as right_turn if the add_turn option was invoked during graph creation. The default value is 0.0.
server_idIndicates which graph server(s) to send the request to. Default is to send to the server, amongst those containing the corresponding graph, that has the most computational bandwidth. For SHORTEST_PATH solver, the input is split among the server containing the corresponding graph.
sharp_turn_penaltyThis will add an additional weight over the edges labeled as sharp_turn or u_turn if the add_turn option was invoked during graph creation. The default value is 0.0.
solve_heuristicThe heuristic search criterion to use, only for geo graphs and SHORTEST_PATH solves towards a single target. Specify astar to use an A-STAR heuristic. The default value is none.
uniform_weightsWhen specified, assigns the given value to all the edges in the graph. Note that weights provided using weights_on_edges will override this value.

Examples

Using the EXECUTE FUNCTION syntax necessitates the SOLUTION_TABLE parameter to store the solve results, where using the table function syntax will return the results directly.