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

# modify_graph

<div className="kinetica-pydoc">
  <div className="dl py method">
    <div className="dt sig sig-object py" id="gpudb.GPUdb.modify_graph"> <span className="sig-name descname"><span className="pre">modify\_graph</span></span><span className="sig-paren">(</span><span className="em sig-param"><span className="n"><span className="pre">graph\_name</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">nodes</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">edges</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">weights</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">restrictions</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">None</span></span></span>, <span className="em sig-param"><span className="n"><span className="pre">options</span></span><span className="o"><span className="pre">=</span></span><span className="default_value"><span className="pre">{"{"}{"}"}</span></span></span><span className="sig-paren">)</span><a href="https://github.com/kineticadb/kinetica-api-python/blob/master/gpudb/gpudb.py#L36776"><span className="viewcode-link"><span className="pre">\[source]</span></span></a></div>

    <div className="dd">
      <p>Update an existing graph network using given nodes, edges, weights, restrictions, and options.</p>
      <p>IMPORTANT: It’s highly recommended that you review the <a className="reference external" href="/content/graph_solver/network_graph_solver/">Graphs and Solvers</a> concepts documentation, and <a className="reference external" href="/content/guides/graph_rest_guide/">Graph REST Tutorial</a> before using this endpoint.</p>
      <p><strong>Parameters</strong></p>

      <div className="blockquote">
        <div>
          <div className="dl">
            <div className="dt">graph\_name (<span className="em">str</span>) –</div>

            <div className="dd">
              <p>Name of the graph resource to modify.</p>
            </div>

            <div className="dt">nodes (<span className="em">list of str</span>) –</div>

            <div className="dd">
              <p>Nodes with which to update existing input parameter <span className="em">nodes</span> in graph specified by input parameter <span className="em">graph\_name</span>. Review <a className="reference external" href="/content/graph_solver/network_graph_solver/#nodes">Nodes</a> for more information. Nodes must be specified using <a className="reference external" href="/content/graph_solver/network_graph_solver/#identifiers">identifiers</a>; identifiers are grouped as <a className="reference external" href="/content/graph_solver/network_graph_solver/#id-combos">combinations</a>. 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 raw values, e.g., ‘{"{"}9, 10, 11{"}"} AS NODE\_ID’. If using raw values in an identifier combination, the number of values specified must match across the combination. Identifier combination(s) do not have to match the method used to create the graph, e.g., if column names were specified to create the graph, expressions or raw values could also be used to modify the graph. The user can provide a single element (which will be automatically promoted to a list internally) or a list.</p>
            </div>

            <div className="dt">edges (<span className="em">list of str</span>) –</div>

            <div className="dd">
              <p>Edges with which to update existing input parameter <span className="em">edges</span> in graph specified by input parameter <span className="em">graph\_name</span>. Review <a className="reference external" href="/content/graph_solver/network_graph_solver/#edges">Edges</a> for more information. Edges must be specified using <a className="reference external" href="/content/graph_solver/network_graph_solver/#identifiers">identifiers</a>; identifiers are grouped as <a className="reference external" href="/content/graph_solver/network_graph_solver/#id-combos">combinations</a>. 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 raw values, e.g., “{"{"}‘family’, ‘coworker’{"}"} AS EDGE\_LABEL”. If using raw values in an identifier combination, the number of values specified must match across the combination. Identifier combination(s) do not have to match the method used to create the graph, e.g., if column names were specified to create the graph, expressions or raw values could also be used to modify the graph. The user can provide a single element (which will be automatically promoted to a list internally) or a list.</p>
            </div>

            <div className="dt">weights (<span className="em">list of str</span>) –</div>

            <div className="dd">
              <p>Weights with which to update existing input parameter <span className="em">weights</span> in graph specified by input parameter <span className="em">graph\_name</span>. Review <a className="reference external" href="/content/graph_solver/network_graph_solver/#graph-weights">Weights</a> for more information. Weights must be specified using <a className="reference external" href="/content/graph_solver/network_graph_solver/#identifiers">identifiers</a>; identifiers are grouped as <a className="reference external" href="/content/graph_solver/network_graph_solver/#id-combos">combinations</a>. 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 raw values, e.g., ‘{"{"}4, 15{"}"} AS WEIGHTS\_VALUESPECIFIED’. If using raw values in an identifier combination, the number of values specified must match across the combination. Identifier combination(s) do not have to match the method used to create the graph, e.g., if column names were specified to create the graph, expressions or raw values could also be used to modify the graph. The user can provide a single element (which will be automatically promoted to a list internally) or a list.</p>
            </div>

            <div className="dt">restrictions (<span className="em">list of str</span>) –</div>

            <div className="dd">
              <p>Restrictions with which to update existing input parameter <span className="em">restrictions</span> in graph specified by input parameter <span className="em">graph\_name</span>. Review <a className="reference external" href="/content/graph_solver/network_graph_solver/#graph-restrictions">Restrictions</a> for more information. Restrictions must be specified using <a className="reference external" href="/content/graph_solver/network_graph_solver/#identifiers">identifiers</a>; identifiers are grouped as <a className="reference external" href="/content/graph_solver/network_graph_solver/#id-combos">combinations</a>. 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 raw values, e.g., ‘{"{"}0, 0, 0, 1{"}"} AS RESTRICTIONS\_ONOFFCOMPARED’. If using raw values in an identifier combination, the number of values specified must match across the combination. Identifier combination(s) do not have to match the method used to create the graph, e.g., if column names were specified to create the graph, expressions or raw values could also be used to modify the graph. The user can provide a single element (which will be automatically promoted to a list internally) or a list.</p>
            </div>

            <div className="dt">options (<span className="em">dict of str to str</span>) –</div>

            <div className="dd">
              <p>Optional parameters. Allowed keys are:</p>

              <ul>
                <li>
                  <p><strong>restriction\_threshold\_value</strong> – Value-based restriction comparison. Any node or edge with a RESTRICTIONS\_VALUECOMPARED value greater than the <span className="em">restriction\_threshold\_value</span> will not be included in the graph.</p>
                </li>

                <li>
                  <p><strong>export\_create\_results</strong> – If set to <span className="em">true</span>, returns the graph topology in the response as arrays. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>enable\_graph\_draw</strong> – If set to <span className="em">true</span>, adds a ‘EDGE\_WKTLINE’ column identifier to the specified <span className="em">graph\_table</span> so the graph can be viewed via WMS; for social and non-geospatial graphs, the ‘EDGE\_WKTLINE’ column identifier will be populated with spatial coordinates derived from a flattening layout algorithm so the graph can still be viewed. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>save\_persist</strong> – If set to <span className="em">true</span>, the graph will be saved in the persist directory (see the <a className="reference external" href="/content/config/">config reference</a> for more information). If set to <span className="em">false</span>, the graph will be removed when the graph server is shutdown. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>add\_table\_monitor</strong> – Adds 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 <span className="em">save\_persist</span> is also set to <span className="em">true</span>, the graph will be fully reconstructed and the table monitors will be reattached. For more details on table monitors, see <a className="reference internal" href="#gpudb.GPUdb.create_table_monitor" title="gpudb.GPUdb.create_table_monitor"><code className="xref py py-meth docutils literal notranslate"><span className="pre">GPUdb.create\_table\_monitor()</span></code></a>. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>graph\_table</strong> – If specified, the created graph is also created as a table with the given name, in \[schema\_name.]table\_name format, using standard <a className="reference external" href="/content/concepts/tables/#table-name-resolution">name resolution rules</a> and meeting <a className="reference external" href="/content/concepts/tables/#table-naming-criteria">table naming criteria</a>. This table will have the following identifier columns: ‘EDGE\_ID’, ‘EDGE\_NODE1\_ID’, ‘EDGE\_NODE2\_ID’. If left blank, no table is created. The default value is ‘’.</p>
                </li>

                <li>
                  <p><strong>remove\_label\_only</strong> – When RESTRICTIONS on labeled entities requested, if set to true this will NOT delete the entity but only the label associated with the entity. Otherwise (default), it’ll delete the label AND the entity. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>add\_turns</strong> – Adds 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). Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘false’.</p>
                </li>

                <li>
                  <p><strong>turn\_angle</strong> – Value in degrees modifies the thresholds for attributing right, left, sharp turns, and intersections. It is the vertical deviation angle from the incoming edge to the intersection node. The larger the value, the larger the threshold for sharp turns and intersections; the smaller the value, the larger the threshold for right and left turns; 0 \< turn\_angle \< 90. The default value is ‘60’.</p>
                </li>

                <li>
                  <p><strong>use\_rtree</strong> – Use an range tree structure to accelerate and improve the accuracy of snapping, especially to edges. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘true’.</p>
                </li>

                <li>
                  <p><strong>label\_delimiter</strong> – If provided the label string will be split according to this delimiter and each sub-string will be applied as a separate label onto the specified edge. The default value is ‘’.</p>
                </li>

                <li>
                  <p><strong>allow\_multiple\_edges</strong> – Multigraph choice; allowing multiple edges with the same node pairs if set to true, otherwise, new edges with existing same node pairs will not be inserted. Allowed values are:</p>

                  <ul className="simple">
                    <li>
                      <p>true</p>
                    </li>

                    <li>
                      <p>false</p>
                    </li>
                  </ul>

                  <p>The default value is ‘true’.</p>
                </li>

                <li>
                  <p><strong>embedding\_table</strong> – If table exists (should be generated by the match/graph match\_embedding solver), the vector embeddings for the newly inserted nodes will be appended into this table. The default value is ‘’.</p>
                </li>
              </ul>

              <p>The default value is an empty dict ( {"{"}{"}"} ).</p>
            </div>
          </div>
        </div>
      </div>

      <p><strong>Returns</strong></p>

      <div className="blockquote">
        <div>
          <p>A dict with the following entries–</p>

          <div className="dl simple">
            <div className="dt">result (<span className="em">bool</span>) –</div>

            <div className="dd">
              <p>Indicates a successful modification on all servers.</p>
            </div>

            <div className="dt">num\_nodes (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>Total number of nodes in the graph.</p>
            </div>

            <div className="dt">num\_edges (<span className="em">long</span>) –</div>

            <div className="dd">
              <p>Total number of edges in the graph.</p>
            </div>

            <div className="dt">edges\_ids (<span className="em">list of longs</span>) –</div>

            <div className="dd">
              <p>Edges given as pairs of node indices. Only populated if <span className="em">export\_create\_results</span> is set to <span className="em">true</span>.</p>
            </div>

            <div className="dt">info (<span className="em">dict of str to str</span>) –</div>

            <div className="dd">
              <p>Additional information.</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
