Skip to content

Add convenience functions for modifying the TensorNetwork graph.

There are some operations on TensorNetworks that are not as simple as they should be. As an example I think that a TensorNetworks should have the functions

  • TensorNetwork::remove_node(const size_t _nodeId) : removes the node from the TensorNetwork and inserts the newly created external links at the end of externalLinks (in the order they had on the node tensor)
  • TensorNetwork::remove_link(const size_t _nodeId1, const size_t _nodeId2) : removes the link between the given nodes and inserts the newly created external links at the end of externalLinks

The first function is useful when computing the gradient of a TensorNetwork w.r.t. the given node. The second one will probably be used mainly as a subroutine of the first one.

Related tasks like add_node can be done using Einstein notation. Maybe we can find something similar for these tasks.