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

# create_graph

### create\_graph

<ul>
  <li>
    create\_graph(\
    &#x20;graph\_name: string,\
    &#x20;directed\_graph: boolean | undefined,\
    &#x20;nodes: string\[],\
    &#x20;edges: string\[],\
    &#x20;weights: string\[],\
    &#x20;restrictions: string\[],\
    &#x20;options?: Record\<string, string>,\
    &#x20;callback?: [GPUdbCallback](https://docs.kinetica.com/content/api/nodejs/types/GPUdbCallback.md),\
    ): Promise\<[CreateGraphResponse](https://docs.kinetica.com/content/api/nodejs/interfaces/CreateGraphResponse.md)>

    Creates a new graph network using given nodes, edges, weights, and restrictions.IMPORTANT: It's highly recommended that you review the Graphs and Solvers concepts documentation, the Graph REST Tutorial, and/or some graph examples before using this endpoint.

    #### Parameters

    <ul>
      <li>
        graph\_name: string

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

      <li>
        directed\_graph: boolean | undefined

        If set to true, the graph will be directed. If set to false, the graph will not be directed. Consult Directed Graphs for more details.
      </li>

      <li>
        nodes: string\[]

        Nodes represent fundamental topological units of a graph. Nodes must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., 'table.column AS NODE\_ID', expressions, e.g., 'ST\_MAKEPOINT(column1, column2) AS NODE\_WKTPOINT', or constant values, e.g., '\{9, 10, 11} AS NODE\_ID'. If using constant values in an identifier combination, the number of values specified must match across the combination.
      </li>

      <li>
        edges: string\[]

        Edges represent the required fundamental topological unit of a graph that typically connect nodes. Edges must be specified using identifiers; identifiers are grouped as combinations. Identifiers can be used with existing column names, e.g., 'table.column AS EDGE\_ID', expressions, e.g., 'SUBSTR(column, 1, 6) AS EDGE\_NODE1\_NAME', or constant values, e.g., "\{'family', 'coworker'} AS EDGE\_LABEL". If using constant values in an identifier combination, the number of values specified must match across the combination.
      </li>

      <li>
        weights: string\[]

        Weights represent a method of informing the graph solver of the cost of including a given edge in a solution. 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} AS WEIGHTS\_VALUESPECIFIED'. If using constant values in an identifier combination, the number of values specified must match across the combination.
      </li>

      <li>
        restrictions: string\[]

        Restrictions represent a method of informing the graph solver which edges and/or nodes should be ignored for the solution. 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.
      </li>

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

        Optional parameters.
      </li>

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

        Optional callback function
      </li>
    </ul>

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

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

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

### create\_graph\_request

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

    Creates a new graph network using given nodes, edges, weights, and restrictions.IMPORTANT: It's highly recommended that you review the Graphs and Solvers concepts documentation, the Graph REST Tutorial, and/or some graph examples before using this endpoint.

    #### Parameters

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

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

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

        Optional callback function
      </li>
    </ul>

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

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

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


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