Definition of SiblingSubgraph
#406
Replies: 5 comments 8 replies
-
To make this self-contained: I suggest defining sibling subgraphs as follows. Let A subgraph is well-formed if every edge in As an edge case, the subgraph This would easily allow the definition of subgraphs such as the following: graph TD
0-->|incoming|1
subgraph "subgraph"
2-->1
end
1-->|outgoing|3
More generally, any subgraph can be defined in this way, except for the empty subgraph. I think it is good to be able to define non-convex subgraphs, as that makes the convexity check more useful. Restricting the type of subgraphs that are representable would mean one of two things
|
Beta Was this translation helpful? Give feedback.
-
NB this definition also allows for slightly mind-bending stuff such as graph TD
0 --> 1
1 -.->|incoming/outgoing| 0
where nodes |
Beta Was this translation helpful? Give feedback.
-
Sorry, I got confused at the first sentence of the definition; I think it needs to be clarified.
looks like the traditional mathematical definition of a graph as a set of vertices and a set of (ordered) pairs of vertices. But this has no notion of "boundary edges". I guess that by
you mean something like
But then which are "incoming" and which are "outgoing"? Not meaning to be pedantic, just trying to understand the definition. |
Beta Was this translation helpful? Give feedback.
-
OK, thanks. Would this work?
(Here "future" means reachable by following edges, and "past" means reachable by following reverse edges.) (Note I haven't said "HUGR" because I'm not sure the definition needs any more structure than "graph", does it?) And "well-formedness" would be something like: for every edge |
Beta Was this translation helpful? Give feedback.
-
After our discussion yesterday, I have gone with the simplest solution of all: we can only represent convex subgraphs (convexity is checked at construction time). Subgraphs will simply be defined by the set of nodes inducing the subgraph. Convex graphs are always induced subgraphs, so they can be defined by a set of nodes. Furthermore, given that the entire subgraph must be traversed to check for convexity and find minimal and maximal node sets, we might as well store all the nodes that we traverse. Runtime overhead will be tiny, and space overhead should not be an issue for our purposes, as we are mostly interested in rewriting small regions. |
Beta Was this translation helpful? Give feedback.
-
@acl-cqc has pointed out that my definition of a subgraph was a bit hard to follow. I have suggested the following rewording of the well-formedness conditions.
See below for details, or #336 (comment) for the original discussion.
What do people think?
Beta Was this translation helpful? Give feedback.
All reactions