We represent the masses in a spectrum as a sequence Spectrum of integers s1,…,sm in increasing order, where s1 is zero and sm is the total mass of the (unknown) peptide. We define a labeled graph Graph(Spectrum) by forming a node for each element of Spectrum, then connecting nodes si and sj by a directed edge labeled by an amino acid a if sj−si is equal to the mass of a. As we assumed when sequencing antibiotics, we do not distinguish between amino acids having the same integer masses (i.e., the pairs K/Q and I/L).
Spectrum Graph Construction
Construct the graph of a spectrum.
Given: A space-delimited list of integers Spectrum.
Return:Graph(Spectrum).
Note: In this chapter, all dataset problems implicitly use the standard integer-valued mass table for the regular twenty amino acids. Examples sometimes use imaginary amino acids X and Z having respective integer masses 4 and 5.