Efficient Minimax Detection on Graphs