Skip to content

Create a "remove-nonlocal-edges" pass #1234

Open
@doug-q

Description

@doug-q

By "remove" I mean mutate the hugr so that the what was a non-local edge becomes many edges threaded through all container nodes between(in the hierarchy sense) the two nodes.

I expect that for many passes, removing all nonlocal edges would make their implementation simpler.

I have in mind a hugr -> hugr transformation that involves converting a non-linear type into a linear type. Linear types cannot be on non-local edges, so it is natural to run "remove-nonlocal-edges" as the first stage.

Likely a "create-nonlocal-edges" pass that, wherever possible, removes non-linear edges into container nodes, would also be useful. One can construct graphs where nearly all edges are removed by such a pass, making the size of Hugr O(nodes) instead of O(nodes^2) although it's unclear what the gains would be in practise.

It may be worthwhile to create both passes at the same time, since their logic is very similar.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions