> ## 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

### solve\_graph

<ul>
  <li>
    solve\_graph(\
    &#x20;graph\_name: string,\
    &#x20;weights\_on\_edges?: string\[],\
    &#x20;restrictions?: string\[],\
    &#x20;solver\_type?: string,\
    &#x20;source\_nodes?: string\[],\
    &#x20;destination\_nodes?: string\[],\
    &#x20;solution\_table?: string,\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md),\
    ): Promise\<[SolveGraphResponse](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphResponse.md)>

    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.

    #### Parameters

    <ul>
      <li>
        graph\_name: string

        Name of the graph resource to solve.
      </li>

      <li>
        `Optional`weights\_on\_edges: string\[]

        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>
        `Optional`restrictions: string\[]

        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>
        `Optional`solver\_type: string

        The type of solver to use for the graph.
      </li>

      <li>
        `Optional`source\_nodes: string\[]

        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>
        `Optional`destination\_nodes: string\[]

        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>
        `Optional`solution\_table: string

        Name of the table to store the solution, in \[schema\_name.]table\_name format, using standard name resolution rules.
      </li>

      <li>
        `Optional`options: Record\<string, string>

        Additional parameters.
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[SolveGraphResponse](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphResponse.md)>

    Promise\<Types.SolveGraphResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:14713](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L14713)</li>
    </ul>
  </li>
</ul>

### solve\_graph\_request

<ul>
  <li>
    solve\_graph\_request(\
    &#x20;request: [SolveGraphRequest](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphRequest.md),\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md),\
    ): Promise\<[SolveGraphResponse](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphResponse.md)>

    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.

    #### Parameters

    <ul>
      <li>
        request: [SolveGraphRequest](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphRequest.md)

        Request object containing the parameters for the operation
      </li>

      <li>
        `Optional`callback: [GPUdbCallback](https://docs.kinetica.com/content/api/typescript/types/GPUdbCallback.md)

        Optional callback function
      </li>
    </ul>

    #### Returns Promise\<[SolveGraphResponse](https://docs.kinetica.com/content/api/typescript/interfaces/SolveGraphResponse.md)>

    Promise\<Types.SolveGraphResponse> - Promise resolving to the response

    <ul>
      <li>Defined in [src/GPUdb.ts:14651](https://github.com/kineticadb/kinetica-api-typescript/blob/master/src/GPUdb.ts#L14651)</li>
    </ul>
  </li>
</ul>


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