We present graph-clear: a novel pursuit-evasion problem on graphs which models the detection of intruders in complex indoor environments by robot teams. The environment is represented by a graph, and a robot team can execute sweep and block actions on vertices and edges, respectively. A sweep action detects intruders in a vertex and represents the capability of the robot team to detect intruders in the region associated to the vertex. Similarly, a block action prevents intruders from crossing an edge and represents the capability to detect intruders as they move between regions. Both actions may require multiple robots to be executed. A strategy is a sequence of block and sweep actions to detect all intruders. When instances of graph-clear are being solved, the goal is to determine optimal strategies, i.e., strategies that use the least number of robots. We prove that for the general case of graphs, the problem of computation of optimal strategies is NP-hard. Next, for the special case of trees, we provide a polynomial-time algorithm. The algorithm ensures that throughout the execution of the strategy, all cleared vertices form a connected subtree, and we show that it produces optimal strategies.