Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not a complete solution, but here goes:</p> <ul> <li>For each connected component keep a spanning tree in memory <ul> <li>Tree property A: Our spanning tree has a notion of which node is "above" which (like in search trees). The choice of which is above which is arbitrary</li> </ul></li> <li>Let's discuss removing and adding edges</li> <li>When adding an edge: <ul> <li>Check if the two nodes are in the same component by checking if their trees' roots are the same <ul> <li>Tree property B: The tree should be dense so this check would be O(log n)</li> </ul></li> <li>If in same group then do nothing</li> <li>If they are in different groups then join the trees with the new edge. <ul> <li>This would require to transform "the shape" (the definition of who is above who) of one of the trees so our new edge could be "above" it</li> </ul></li> </ul></li> <li>When removing an edge: <ul> <li>If this edge does not participate in a group's spanning tree then do nothing.</li> <li>If it does, we would need to check if the group is still connected <ul> <li>DFS from one group to try reach the other one</li> <li>Better do it from the smaller of the two <ul> <li>Tree property C: We maintain for each node in the tree the size of its subtree</li> <li>Using property C we can tell both groups' sizes</li> </ul></li> <li>Because of property B: usually the smaller group will be very small and the larger group will be very large</li> <li>If the groups are connected then we act as if we added the connecting edge</li> <li>If the groups are not connected then we should climb the tree to maintain property C (subtract the size of the previously connected subtree from the ancestors' subtree sizes)</li> </ul></li> </ul></li> <li>Problem: How do we maintain property B (the tree is dense)?</li> </ul> <p>I hope this makes sense :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload