concept : In an no-map, The smallest spanning tree that is found when a particular point is limited to a condition that must be K degrees.
some elaborated :
[ about Letters ] :
set the edge set to e , special point is v0 , minimum limit spanning tree is d .
Hi represents V0 the degree is I the minimum spanning tree.
[ about Operations ] :
Delete add: Add a vertex to the tree V0 The point in the formed ring, delete the other V0 The associated edge.
Maximum deletion: Remove the largest one in the ring when adding V0 The associated edge.
Maximum difference: The maximum of the added edge and the maximum value of the deletion added.
principle : See Black Book p300-p303.
proved somewhat complex, so skipped the proof to get theorem one:
ifTto beV1 ... Vnthe smallest spanning tree, if the edge(I,J)does not belong toT, you(I,J)does not belong toD.
This greatly reduces the range of edges you select.
Theorem Two:
H1 to be T on the basis of adding a shortest (V0,VI)
H1 can be done by k-1 Minor Difference Minimum delete add operation obtained Hk .
this will facilitate our H1 gradually pushed to Hk
Specific steps :
1 . find V1 ... for all connected blocks of Vn, the smallest spanning tree of each connected block is obtained .
2. selects a minimum and connected side [ if the number of blocks t>k Span style= "font-family: Founder su new poetry Liu Yu simplified;" > no solution ] , thus getting ht .
3.fori=t+1 to K
through Hi-1 To Add and remove an edge by adding and removing the "minimum difference" Hi .
where the difference is minimized the optimization of the addition operation can be used: MakeMaxirepresentsVito theV0the maximum edge on the path, then connect the(V0,VI)the price isf (Vi) =w (v0,vi)-maxi, allf (Vi)the minimum value in the difference is the least-added operation.
Maxithe preprocessing needsO (n)fromV0StartDFS, each time you choose a(V0,VI)then you need to start fromViOne more run, too.O (n)the.
4. Output Answer
Topic Practice : Poj Picnic planning Picnic Plan
Haven't hit the code yet ... Not to be continued
Minimum spanning tree with degree limits