I have an undirected graph which has some amount of nodes and edges.
Each of the nodes is of certain color and each of the edges is of certain type, determined by the color of nodes it connects to :
- An edge connecting a red and blue node is of type red-blue.
- Since the graph is undirected:
red-blue == blue-red.
I am tasked with writing the algorithm that will find all the edges that are "isolated".
An edge is isolated when there is at least a 2 edges distance between the original edge and the next edge of the same type as the original one.
What would be the best way to do this? Most likely it can be solved using breadth/depth first search, but I cannot figure out a way to connect them to this specific problem