A binary graph is a non direction graph, and its n vertices can be divided into set a and set B, and any two vertices in the same set are inextricably connected in the graph (that is, any edge is one vertex in set a and the other in set B). When and only if each vertex in B is at least connected to a vertex in a, a subset of a ' overrides the set B (or simply, a ' is an overlay). Overwrite the size of a ' is the number of vertices in a '. When and only if a is the smallest of a subset that covers B, a ' is the minimum overlay.
Example 1-10 examines the two graphs with 1 7 vertices, as shown in Figure 1-6, A={1, 2, 3, 16, 17} and B={4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, Subset A ' ={1, 1 6, 1 7} is the smallest of B Covered. The problem of finding a minimum covering in a binary graph is two-point coverage (b I p a r t i t e-c o v e r). The minimum coverage is useful in Example 1 2-3 because it solves the problem of "translating with the fewest translators in a meeting".
A binary overlay problem is similar to a collection overlay (S e t-c o v e r) problem. The K set s={s1, S2,., Sk} are given in the set covering problem, and the elements in each set Si are members of the universal U. When and only if the Èi s ' si=u, the number of sets s ' covering U,s ' is the size of the overlay. When and only if there is no smaller set that can cover U, call S ' is the smallest overlay. You can turn a collection overlay problem into a two-point overlay problem (and vice versa), which means S1 is represented by the vertex of a,., Sk, the vertices in B represent the elements in U. If and only if the corresponding set of s contains the corresponding element in U, there is an edge between the vertices of a and b.
Example 1-11 s={s1,...,s5}, u={4,5,...,15}, s1={4,6,7,8,9,1 3},s2={4,5,6,8},s3={8,1 0,1 2,1 4,1 5},s4={5,6,8,1 2,1 4, 1 5},s5={4,9,1 0,11}. S ' ={s1,s4,s5} is an overlay with a size of 3, with no smaller cover, s ' that is the smallest covering. This set overlay problem can be mapped to a graph in Fig. 1-6, which means that the vertex 1,2,3,1 6 and 1 7 represent the set S1,S2,S3,S4 and S5 respectively, and vertex J represents the element J,4≤j≤1 5 in the collection.
The problem of Set overlay is n p complex problem. Because the set cover and the double coverage are the same kind of problems, the problem of the binary coverage is n P-complex. Therefore, it may not be possible to find a fast algorithm to solve it, but the greedy algorithm can be used to find a fast heuristic method. One of the possible steps is to build overlay a ', and each step selects a vertex in a to join the overlay. The selection of vertices utilizes the greedy rule: Select a vertex from a that can overwrite the number of elements in B that have not yet been overwritten.
Example 1-12 examines the graph shown in Figure 1-6, initializes a ' = and no vertices are overwritten in B, vertices 1 and 1 6 can cover six vertices in B, Vertex 3 covers five, vertices 2 and 1 7 are covered four respectively. So, in the first step, add vertices 1 or 1 6 to a '. If you add a vertex of 1 6, it overwrites the vertices {5, 6, 8, 1 2, 1 4, 1 5}, and the vertices that are not covered are {4, 7, 9, 1 0, 11, 1 3}. Vertex 1 can cover four vertices ({4), 7, 9, 1 3}), Vertex 2 covers one ({4}), Vertex 3 covers one ({1 0}), vertex 1 6 covers 0, Vertex 1 7 covers four {4, 9, 1 0, 11}. Next you can choose 1 or 1 7 to join a '. If you select vertex 1, the vertex {1 0, 11} is still not overwritten, at which point 1,2,1 6 does not cover any of them, Vertex 3 covers one, vertex 1 7 covers two, so select vertex 1 7, all vertices have been overwritten, get a ' ={1 6, 1, 1 7}.
Fig. 1-7 shows the pseudo code of greedy override heuristic method, it can be proved that: 1 when and only when the initial binary graph is not covered, the algorithm cannot find the coverage; 2 The heuristic method may not find the smallest overlay of the binary graph.
1. Data structure selection and complexity analysis
To implement the algorithm in Figure 13-7, you need to select a ' description and consider how to record the number of nodes in B that are not covered by the node in a. Because the set a ' uses only addition operations, you can use one-dimensional integer array C to describe a ', and M to record the number of elements in a '. Record the members of a ' in c[0:m-1]. For vertex I of a, the number of vertices not covered in B that can be covered by n e wi as I. Gradually select the highest vertex of the N e wi value. Because some of the previously uncovered vertices are now overwritten, you also need to modify the N e wi values. In this update, check for the most recent V-covered vertex in B, so that j is such a vertex that all the n e wi values of all the vertices covering j in a are reduced by 1.