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

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/create_graph.rs#L61-L80)
pub async fn [create\_graph](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/create-graph.md#method.create_graph)( \&self, graph\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), directed\_graph: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html), 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)>, 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)>, weights: [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)>, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CreateGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Create a new graph network.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.

##### Arguments

<ul>
  <li>`graph_name` - Name of the graph resource to generate.</li>
  <li>`directed_graph` - 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` - 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` - 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` - 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` - 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>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/create_graph.rs#L133-L159)
pub async fn [create\_graph\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/create-graph.md#method.create_graph_with_opts)( \&self, graph\_name: [String](https://doc.rust-lang.org/1.98.1/alloc/string/struct.String.html), directed\_graph: [bool](https://doc.rust-lang.org/1.98.1/std/primitive.bool.html), 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)>, 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)>, weights: [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)>, options: [CreateGraphRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CreateGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Create a new graph network.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.

##### Arguments

<ul>
  <li>`graph_name` - Name of the graph resource to generate.</li>
  <li>`directed_graph` - 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` - 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` - 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` - 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` - 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>`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/create_graph.rs#L162-L173)
pub async fn [create\_graph\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/create-graph.md#method.create_graph_raw)( \&self, request: &[CreateGraphRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[CreateGraphResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

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

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

Sends a pre-built [`CreateGraphRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.CreateGraphRequest) 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.