Subgraph label sets
Closed this issue · 1 comments
A nice touch for the labeled subgraphs would be to maintain a label set, the subset of labels from the supergraph that are represented in the subgraph. This could be easily accumulated as subgraphs are being constructed perhaps saving a traversal afterwards to locate these.
...
Maybe it could be optional. Labeled subgraph types could have a map member that would be allowed to be be nil. If non-nil, then AddArc and AddEdge methods would maintain it. Induce methods would take a flag saying whether or not to initialize the map. There could also be a RecalcLabelSet method.
Maybe LabelSet would be a useful method for the labeled graph types anyway? Then maybe the method on the labeled subgraph types would be too trival to justify API. The types could just have a line of doc suggesting s.LabelSet = s.LabelSet().
It might always be faster to generate a subgraph without accumulating lables, then gather them with a traversal afterwards. Then it would be more a convenience to have the label set stored with the subgraph rather than an optimization. Still might be nice.
Added ArcLabels. Maybe that's enough for now.