I am trying to figure out an algorithm for the following situation: I want to run a minimum cost algorithm on an undirected graph. The edges have a cost associated to them, and the vertexes have 2 costs associated to which one them. This is where it gets kind of tricky. I have to pick one of the 2 costs associated to the vertex. If I choose cost1, the vertex will be of type 1, if I choose cost2, the vertex will be of type 2. Vertexes can only be considered connected by an edge IF they are of different types. Most of the time it will be logical to pick the lowest cost for the vertex, but depending of the cost of its edges associated to it, and the type of its neighbor vertex, you would prefer to pick the highest cost for the vertex, resulting on an smaller overall cost. Any sugestions like which algorithm or what methods I should try to apply would be much appreciated.
Here is a link to a simple example of what I am trying to achieve. The cost of this solution is 57, which is the lowest possible cost for this graph.
edit: Spelling.