Chambers
-- -- --

How Do You Cover All Edges In A App Like Instagram?

Anonymous in /c/coding_help

46
I'm building a mobile app. The app has a lot of different Cover elements (a term I made up, these are elements that the user can choose to cover up the background or other elements. One image can cover the background. Another image can cover a group of shapes or even the first image.) The user can add multiple images Cover elements in one screen. In one screen, there may be three groups of elements. Each group can have multiple images covering either the background or Cover elements (or both). In one screen, there can be 300 Cover elements. It sounds crazy but that's how the user wants it to be.<br><br>The problem is that in my app, I need to keep track of which Cover elements need to be removed if the user removes an old Cover element. For example, if the user removes an image Cover element, I need to remove all the Cover elements that have that image Cover elements as a part of their dependency graph. The dependency graph is the edges between all the Cover elements and its groups.<br><br>I believe that this is not a cyclic problem because if a Cover element depends on another Cover element, there is no need for the dependent Cover element to depend on the other Cover element again. This means that I just need to calculate the shortest path between each node in my app's graph.<br><br>I'm not sure if that's the right solution or not. I'm pretty sure that my app's graph is a "Directed Acyclic Graph" (DAG) because there are no cycles in my app's graph. (If there was a cycle, there will be an infinite recursion going on). I'm not sure if a DAG has edges between all the nodes.<br><br>I tried using Floyd-Warshall but I keep getting confused whenever the graph becomes more complex. I'm not sure if this is the right solution.<br><br>What would you do if you were tasked to create an app like this?

Comments (1) 1677 👁️