Search code examples
algorithmcomputer-sciencegraph-algorithmtheory

Algorithm for visiting edges of graph in parallel?


Reference graph:

enter image description here

I am writing a program which tests all the edges of a graph. The program can test the edges of a graph in parallel if and only if they do not share a common node. My problem comes from the fact that I must also have the option not to test the edges in the most efficient way possible.

If testing the most efficient choice of parallel edges on the graph above, Edges AB, DE, and CF can all be tested in parallel the first cycle, followed by AD, BC, and EF during the second. This leaves only BE left for the third cycle.

If I am limited to only two parallel edges at once, I could then visit the edges in a number of ways, some more efficient than others. For example: AB and CF could be visited first, followed by BC and AD. this leaves BE, DE, and EF to be tested one at a time for a total of 5 cycles. This is less efficient than visiting AB and DE first, BC and EF second, AD and BE third, with CF as the final edge for a total of 4 cycles.

Is there an algorithm or practice that can be applied to find the most efficient path of visiting a graph in such a manner? My graphs are of variable size and connectivity, so I cannot personally solve and plan them even if I wanted to.

Any help or direction will be appreciated. It has been a while since have had a lesson in graph theory, so I do not remember if anything of this nature exists. I am currently approaching this issue theoretically, and have not yet started to try and implement any sort of programming on this aspect. As such, if my question is better directed elsewhere, I would be more than happy to move my question to the relevant Stack Exchange site.


Solution

  • This problem is edge coloring: https://en.wikipedia.org/wiki/Edge_coloring

    If you color the edges of your graph so that no two adjacent edges have the same color, then you can do one cycle for each color, testing all the edges of that color in parallel.

    Unfortunately, finding a coloring with the smallest number of colors is NP-hard.