Computational Complexity of Edge Coverage Problem for Constrained Control Flow Graphs
This paper investigates the computational complexity of achieving edge coverage in control flow graphs under five distinct constraint types, demonstrating that while POSITIVE constraints remain solvable in polynomial time, NEGATIVE, ONCE, MAX ONCE, and ALWAYS constraints render the problem NP-complete even for acyclic graphs, though the latter admits a fixed-parameter tractable algorithm with respect to the number of constraints.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you are the manager of a massive, complex factory. Your goal is to make sure every single machine, conveyor belt, and switch in the factory has been tested to ensure it works correctly. This is what software engineers call Edge Coverage: making sure every possible "path" through a computer program has been tried out.
Usually, engineers draw a map of the factory (called a Control Flow Graph) and try to find a set of routes that covers every single road.
The Problem: The "Too Many Paths" Trap
The problem with these maps is that they are often too generous. They show paths that look possible on paper but are impossible in reality.
- The Semantic Gap: The map might show a route where you go from "Start" to "Finish" by walking through a wall. In the real factory, walls are solid; you can't walk through them.
- The Cost Trap: The map might show a route that requires you to run 1,000 miles in one hour. Theoretically possible? Maybe. Practically? No.
- The Rule Trap: The map might show a route where you inspect the product after you've already signed the shipping papers. In the real world, rules say you must inspect before signing.
If you try to test every path on the "perfect" map, you'll waste time testing impossible things or breaking the rules.
The Solution: Adding "Traffic Rules"
To fix this, the authors of this paper suggest adding Constraints (Traffic Rules) to the map. These rules tell the testing team what is allowed and what is forbidden. They define five types of rules:
- POSITIVE (The "Must-Do" Rule): "You must take a route where you pass the Security Check before the Loading Dock." (At least one test must do this).
- NEGATIVE (The "Never-Do" Rule): "You are forbidden from passing the Loading Dock before the Security Check." (No test can do this).
- ONCE (The "One-and-Done" Rule): "The combination of 'Security Check' followed immediately by 'Loading Dock' is so expensive to test that we can only do it in exactly one test case."
- MAX-ONCE (The "Don't Overdo It" Rule): "We can do the 'Security Check' then 'Loading Dock' combo in at most one test case. We'd prefer zero, but one is okay."
- ALWAYS (The "If-Then" Rule): "If you ever pass the 'Negotiation' station, you must eventually pass the 'Approval' station later in that same trip."
The Big Discovery: How Hard is it to Plan the Tests?
The authors asked a very deep question: "How hard is it for a computer to figure out a set of test routes that covers every road while obeying all these traffic rules?"
They found that the answer depends entirely on which rule you use:
The Easy Case (POSITIVE): If your only rule is "Make sure you do X at least once," the computer can solve this very quickly. It's like telling a delivery driver, "Make sure you stop at the post office at least once." Easy peasy.
- Verdict: Fast (Polynomial Time).
The Hard Cases (NEGATIVE, ONCE, MAX-ONCE, ALWAYS): If you add rules like "Never do X," "Do X only once," or "If X, then Y," the problem becomes nightmarishly difficult.
- The Analogy: Imagine trying to plan a road trip that visits every city in a country, but you have a list of rules like: "You can't visit Paris if you've been to Rome," "You can only visit London once," and "If you visit Berlin, you must visit Munich later."
- The computer has to check billions of combinations to see if a valid plan even exists. As the number of rules grows, the time it takes to solve it explodes.
- Verdict: Extremely Hard (NP-Complete). Even for simple, non-looping maps, these rules make the problem impossible to solve quickly for large systems.
The Silver Lining: A Special Shortcut
However, the authors found a "cheat code" for the NEGATIVE rules (the "Never-Do" rules).
While the general problem is hard, they discovered that if you have a small number of "Never-Do" rules, you can solve it efficiently.
- The Analogy: If you have a map with 1,000 roads but only 3 "Do Not Enter" signs, a smart algorithm can quickly figure out the best routes. It's only when you have hundreds of "Do Not Enter" signs that the system breaks down.
- Verdict: Manageable if the number of rules is small.
Why Does This Matter?
This paper is a wake-up call for software testers.
- Don't just test everything: Blindly testing every path on a standard map is a waste of time because many paths are impossible.
- Rules are necessary: Adding constraints makes testing realistic and useful.
- Know your limits: If you add complex rules (like "do this only once" or "if this, then that"), you might be asking your computer to solve a puzzle that takes longer than the age of the universe to crack. You need to be careful about how many rules you add, or use special algorithms for specific types of rules.
In short: Testing software with rules is smarter, but it's also much harder mathematically. The authors have mapped out exactly where the "easy" zones end and the "impossible" zones begin.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.