You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifically, preserving edges incoming to the copied subgraph from outside it (adding new edges from the same sources). This is hard to achieve at present:
HugrMut::insert_from_view cannot be used with a view of the same Hugr, because the latter would borrow the Hugr immutably, preventing a mutable borrow to call insert_from_view.
Even if this worked, it would still suffer from the same problem as the next
One can construct a view of the subgraph and then call extract_hugr followed by insert_hugr, but extract_hugr loses the incoming intergraph edges (as it must!)
There is also insert_subgraph but again, this cannot do what is required, because again the borrow-checker allows only to insert a subgraph of another Hugr. (I have not investigated whether the desired behaviour could be achieved by inserting a subgraph of a clone of the same Hugr - besides the cost of cloning, this seems an odd interface, what happens if you insert a subgraph of a different Hugr where the subgraph has incoming nonlocal edges?)
Hence, I think the required method would have to have a signature
@aborgna-q my thought here is to do this is (Multi)Portgraph via a method that takes a set of nodes to copy (edges between them also copied, edges into the set copied but from the original source - hence the MultiPortgraph, edges out of the set....probably an error). Then we pass in set of descendants.
Hierarchy update also needs to know the root of the set, and we could verify all the nodes in the set are hierarchy-reachable from that root (perhaps even that the set includes all nodes hierarchy-reachable from the root).
Specifically, preserving edges incoming to the copied subgraph from outside it (adding new edges from the same sources). This is hard to achieve at present:
insert_from_view
.extract_hugr
followed by insert_hugr, butextract_hugr
loses the incoming intergraph edges (as it must!)Hence, I think the required method would have to have a signature
The bulk of the implementation might (possibly) belong in the portgraph crate.
The text was updated successfully, but these errors were encountered: