You have to update the GraphML file and update the data via the REST API.
This means, you modify the xml file manually or programatically.
Afterwards you must delete the existing (if any) topology
curl -X DELETE -u admin:admin 'http://localhost:8980/opennms/rest/graphml/topology-name'
Finally push the new file:
curl -X POST -H "Content-Type: application/xml" -u admin:admin -firstname.lastname@example.org 'http://localhost:8980/opennms/rest/graphml/topology-name'
Keep in mind, there is no automatically generating of the graphml file in OpenNMS. You always have to generate/build the Topology yourself (either manually or programatically).
See also the Development Guide - 3.2.1 Create/Update/Delete GraphML Topology
Also keep in mind, that the data you see may be cached up to 5 Minutes. Only then you see the changes in the UI. You can manually trigger a reload by sending a reload event with uei
uei.opennms.org/internal/reloadTopology. You can provide the namespace with
namespace parameter or omit it, then the cache for all topologies is evicted:
$OPENNMS_HOME/bin/send-event.pl uei.opennms.org/internal/reloadTopology --parm 'namespace <my-namespace>'