Graph algorithms
A software engineering team is modernizing a legacy system with hundreds of code modules. The goal is to refactor the system by splitting it into independent microservices. A major challenge is the complex network of “imports” between modules. They found that many modules are interdependent; that is, Module A depends on Module B, which in turn, directly or indirectly, depends on Module A. To carry out the microservice separation, the team first needs to identify these groups of mutually dependent modules, since they must be treated as a single unit. Which algorithmic approach would be most effective to identify these groups of modules, considering this problem can be modeled as a directed graph? Analyze the statements below and select the correct alternative:
I. Topological Sorting can be applied because it arranges modules in a linear order of dependencies and, when it fails, it indicates the existence of cycles, making it useful as a diagnostic tool and making it easy to identify the blocks to be isolated.
II. Strongly Connected Components (SCC) analysis, such as the Kosaraju–Sharir algorithm, is sufficient because it directly identifies groups of modules in which every module can reach every other module, making it useful to locate blocks of circular dependency and guide refactoring.
III. A single Depth-First Search (DFS) identifies the strongly connected components, since detecting a cycle in a single DFS is the same as grouping all modules that mutually reach each other, so no extra processing is necessary.
A) Only I and II are correct.
B) Only III is correct.
C) Only II is correct.
D) Only II and III are correct.
E) None of the above.
Original idea by: Thiago Laitz
Boa questão, mas fico me perguntando se um código consegue ser compilado se houver dependências circulares, como o enunciado parece apontar.
ResponderExcluir