You are on page 1of 4

DNA Computing

Eden Weizman 7/8/12

Assignment P5: Solve the 3-color problem by only applying enzymes to your own DNA computer.

Instructions for Use Click to add vertices. Click and drag from one vertex to another to add edges. Then click go.

Algorithm 1) Generate random strands of all color:vertex combinations. 2) Keep only the strands with length equal to or less than n pairs where n is the total number of pairs. 3) Keep only the strands that include each vertex at least once. 4) Keep only the strands where the vertices of each edge are different colors. 5) If any strand remains, it is a solution. Otherwise, there are no solutions.

Every color and every vertex have a unique sequence. All combinations of colors and vertices are put into a test tube in the form <v,c>. Strands are created through random combinations of <v,c> pairs. Remove all strands whose length of pairs is less than or equal to the total number of pairs. Keep all strands that have each vertex, thus ensuring that every stand remaining contains every vertex exactly once, ensuring no conflicts with colors. For each color, run through each strand and separate all strands containing the beginning vertex of that edge with that color and those that do not pair those two up into two different test tubes. For the strands where they are paired up, remove all where the ending vertex of that edge and that color are not paired up and combine that with test tube where the color and the beginning vertex are not paired up. This new test tube contains all solutions to the 3-color problem for that graph. (edges is an array of edges that each have a specific vin and vout) procedure [out] = COLORS(t, edges) t (t, <= n) for i=1 to n do t +(t, vi) end for for i=1 to 3 do for j=1 to edges.length do t2 +(t, <edges[j].vin, ci>) t3 -(t, <edges[j].vin, ci>) t4 -(t2, <edges[j].vout, ci>) t merge(t3, t4) end for end for out detect(t) end procedure Implementation For the implementation it was inefficient to do it randomly and to create random sizes, so the initial test tube started out with all possible combinations of the vertices and the colors with the correct length, and with one of each vertex present. Strands were implemented as arrays of pairs of vertices and colors. The test tube was then filtered by the method described.

Examples of Solutions

An example of a graph that does not have a solution is the following. Because each vertex is connected to the rest, any color that one vertex is will be eliminated for the other vertices. However, there are 4 vertices and only 3 colors.

You might also like