Implement 2-BreakOnGenomeGraph solved by 60

Sept. 7, 2015, 4:12 p.m. by Rosalind Team

We will use 2-Break(1, 6, 3, 8) two denote the 2-break replacing colored edges (1, 6) and (3, 8) in a genome graph with two new colored edges (1, 3) and (6, 8). Note that the order of the nodes in this function matter, since the operation 2-Break(1, 6, 8, 3) would represent a different 2-break that replaces (1, 6) and (3, 8) with (1, 8) and (6, 3).

The following pseudocode describes how 2-Break(i, i′, j, j′) transforms a genome graph.

2-BreakOnGenomeGraph(GenomeGraph, i, i′, j, j′)
     remove colored edges (i, i') and (j, j′) from GenomeGraph
     add colored edges (i, j) and (i, j') to GenomeGraph
     return GenomeGraph

2-Break On Genome Graph Problem

Solve the 2-Break On Genome Graph Problem.

Given: The colored edges of a genome graph GenomeGraph, followed by indices i, i', j, and j'.

Return: The colored edges of the genome graph resulting from applying the 2-break operation.

Sample Dataset

(2, 4), (3, 8), (7, 5), (6, 1)
1, 6, 3, 8

Sample Output

(2, 4), (3, 1), (7, 5), (6, 8)

Extra Dataset

Please login to solve this problem.