> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# solve_graph

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/solve_graph.rs#L59-L80)
pub async fn [solve\_graph](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/solve-graph.md#method.solve_graph)( \&self, graph\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), weights\_on\_edges: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, restrictions: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, solver\_type: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), source\_nodes: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, destination\_nodes: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, solution\_table: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[SolveGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Solves an existing 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.

##### Arguments

<ul>
  <li>`graph_name` - Name of the graph resource to solve.</li>
  <li>`weights_on_edges` - 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.</li>
  <li>`restrictions` - 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’).</li>
  <li>`solver_type` - The type of solver to use for the graph.</li>
  <li>`source_nodes` - It can be one of the nodal identifiers - e.g: ‘NODE\_WKTPOINT’ for source nodes. For BACKHAUL\_ROUTING, this list depicts the fixed assets.</li>
  <li>`destination_nodes` - 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.</li>
  <li>`solution_table` - Name of the table to store the solution, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/solve_graph.rs#L131-L159)
pub async fn [solve\_graph\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/solve-graph.md#method.solve_graph_with_opts)( \&self, graph\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), weights\_on\_edges: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, restrictions: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, solver\_type: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), source\_nodes: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, destination\_nodes: [Vec](https://doc.rust-lang.org/1.98.1/alloc/vec/struct.Vec.html)\<[String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html)>, solution\_table: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), options: [SolveGraphRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[SolveGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Solves an existing 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.

##### Arguments

<ul>
  <li>`graph_name` - Name of the graph resource to solve.</li>
  <li>`weights_on_edges` - 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.</li>
  <li>`restrictions` - 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’).</li>
  <li>`solver_type` - The type of solver to use for the graph.</li>
  <li>`source_nodes` - It can be one of the nodal identifiers - e.g: ‘NODE\_WKTPOINT’ for source nodes. For BACKHAUL\_ROUTING, this list depicts the fixed assets.</li>
  <li>`destination_nodes` - 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.</li>
  <li>`solution_table` - Name of the table to store the solution, in \[schema\_name.]table\_name format, using standard name resolution rules.</li>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/solve_graph.rs#L162-L173)
pub async fn [solve\_graph\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/solve-graph.md#method.solve_graph_raw)( \&self, request: &[SolveGraphRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[SolveGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`SolveGraphRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphRequest) to the `/solve/graph` endpoint.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/solve_graph.rs#L177-L189)
pub async fn [solve\_graph\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/solve-graph.md#method.solve_graph_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[SolveGraphRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[SolveGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`SolveGraphRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.SolveGraphRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.