Get the connected component within the subset "todo" that contains tx (which must be in * todo). * * Two transactions are considered connected if they are both in `todo`, and one is an ancestor * of the other in the entire graph (so not just within `todo`), or transitively there is a * path of transactions connecting them. This does mean that if `todo` contains a transact
| 264 | * Complexity: O(ret.Count()). |
| 265 | */ |
| 266 | SetType GetConnectedComponent(const SetType& todo, DepGraphIndex tx) const noexcept |
| 267 | { |
| 268 | Assume(todo[tx]); |
| 269 | Assume(todo.IsSubsetOf(m_used)); |
| 270 | auto to_add = SetType::Singleton(tx); |
| 271 | SetType ret; |
| 272 | do { |
| 273 | SetType old = ret; |
| 274 | for (auto add : to_add) { |
| 275 | ret |= Descendants(add); |
| 276 | ret |= Ancestors(add); |
| 277 | } |
| 278 | ret &= todo; |
| 279 | to_add = ret - old; |
| 280 | } while (to_add.Any()); |
| 281 | return ret; |
| 282 | } |
| 283 | |
| 284 | /** Find some connected component within the subset "todo" of this graph. |
| 285 | * |