Given a general undirected graph with a Red/Blue coloring on its edges, I'd like to be able to detect all cycles that contain exactly one blue edge in the graph. Is there a known algorithm for this?
I know how to detect cycles in a general graph using a DFS approach, and I can detect the single-blue-edge cycles by backtracking and counting the number of blue edges once I've found a cycle, but this solution would result in edge-quadratic time complexity, as far as I'm aware. Is there anything better?