Skip to main content
Alters an existing graph.
ALTER GRAPH Syntax

Parameters

<schema name>

Name of the schema containing the graph to alter

<graph name>

Name of the graph to alter

EDGES

Graph component, provided as column names, expressions, or constants using the SQL INPUT_TABLE or INPUT_TABLES function, to use for identifying the edges of the graph; 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).

NODES

Graph component, provided as column names, expressions, or constants using the SQL INPUT_TABLE or INPUT_TABLES function, to use for identifying the nodes of the graph; 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).

WEIGHTS

Graph component, provided as column names, expressions, or constants using the SQL INPUT_TABLE or INPUT_TABLES function, to use for identifying the weights of the graph; 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

Graph component, provided as column names, expressions, or constants using the SQL INPUT_TABLE or INPUT_TABLES function, to use for identifying the restrictions of the graph; 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

Indicator that a list of connection option/value assignments will follow, passed as a comma-delimited list of key/value pairs to the KV_PAIRS function
OptionDescription
add_table_monitorAdds a table monitor to every table used in the creation of the graph; this table monitor will trigger the graph to update dynamically upon inserts to the source table(s). Note that upon database restart, if save_persist is also set to true, the graph will be fully reconstructed and the table monitors will be reattached. For more details on table monitors, see Table Monitors. The default value is false.
add_turnsAdds dummy “pillowed” edges around intersection nodes where there are more than three edges so that additional weight penalties can be imposed by the solve endpoints (increases the total number of edges). The default value is false.
allow_multiple_edgesEnables multigraph capability—pairs of nodes can be connected by more than one edge. Without this option, undirected graphs can only have one edge between each pair of nodes, and directed graphs can have one edge in each direction between each pair of nodes—“duplicate” edges are discarded. The default value is true.
cluster_graph_schemaIf export_graph_schema is true, groups nodes based on the Louvain clustering algorithm, converting the graph into a label-based schema.
export_graph_schemaExports a graph’s schema in Graphviz DOT format; this is made available in two ways:
  • visually, by clicking {{< guilabel “View Schema” >}} in the result of an ALTER GRAPH command in a SQL Block within Workbench
  • as text, under the info and then dot keys of the response to a native API call to /execute/sql
graph_tableThe graph is created as a table with the given name, in [schema_name.]table_name format, using standard name resolution rules and meeting table naming criteria. The table will have the following identifier columns: EDGE_ID, EDGE_NODE1_ID, EDGE_NODE2_ID.
label_delimiterIf specified, the delimiter to use when parsing edge labels. All labels separated by this delimiter will be applied to the corresponding edge.
save_persistIf set to true, the graph will be saved in the persist directory (see the config reference for more information). If set to false, the graph will be removed when the graph server is shutdown. The default value is false.
schema_edge_labelkeysIf export_graph_schema is true, generates the label-based schema by collapsing edges based on the their label keys; otherwise, schema edges are created from the edge labels.
schema_node_labelkeysIf export_graph_schema is true, generates the label-based schema by collapsing nodes based on the their label keys; otherwise, schema nodes are created from the node labels.
simplifySimplifies the graph topology at 2-valence by collapsing edge.
use_rtreeUse a range tree structure to accelerate and improve the accuracy of snapping, especially to edges.

Examples

To alter the weights of a graph and allow it to survive a database restart:
ALTER GRAPH Example