The following algorithm constructs ColoredEdges(P) for a genome P. In this pseudocode, we will assume that an n-element array (a_{1}, . . . , a_{n}) has an invisible (n + 1)-th element that is equal to its first element, i.e., a_{n+1} = a_{1}.

ColoredEdges(P) Edges ← an empty set for each chromosome Chromosome in P Nodes ← ChromosomeToCycle(Chromosome) forj ← 1 to |Chromosome| add the edge (Nodes_{2j}, Nodes_{2j +1}) to Edges returnEdges

Colored Edges Problem

Find the Colored Edges in a genome.

Given: A genome P.

Return: The collection of colored edges in the genome graph of P in the form (x, y).