If this subgraph has been merged with another then there is an agreed "representative" for the combined subgraph, which uniquely identifies the subgraph.
| 45 | /// If this subgraph has been merged with another then there is an agreed "representative" for the combined |
| 46 | /// subgraph, which uniquely identifies the subgraph. |
| 47 | PartialSubgraph* GetRepresentative() |
| 48 | { |
| 49 | // Recurse up the tree to find the root node. |
| 50 | if (m_Parent == nullptr) |
| 51 | { |
| 52 | return this; |
| 53 | } |
| 54 | else |
| 55 | { |
| 56 | PartialSubgraph* result = m_Parent->GetRepresentative(); |
| 57 | // Update our parent pointer to point directly to the root in order to speed up future calls to this method. |
| 58 | // This essentially "flattens" the tree. |
| 59 | m_Parent = result; |
| 60 | return result; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /// Merges this subgraph with another. |
| 65 | void MergeWith(PartialSubgraph* other) |
no outgoing calls
no test coverage detected