Maximization Problem for Independence Systems/Greedy Algorithm

Algorithm
Let $S$ be a finitie set.

Let $\mathscr F$ be a hereditary set of subsets.

Let $w : S \to \R_{\ge 0}$ be a weight function.

The greedy algorithm for the maximum weight problem $\struct{\mathscr F, w}$ proceeds as follows:


 * Step 1: Start with $A_0 = \O$.


 * Step 2: Choose $x \in S \setminus A_0$ such that:
 * a): $A_0 \cup \set x \in \mathscr F$
 * b): $\map w x = \max \set{\map w y : y \in S \setminus A_0 \land A_0 \cup \set y \in \mathscr F}$.


 * Step 3: If no such $x$ exists, stop. Otherwise, add $x$ to $A_0$.


 * Step 4: Go to Step 2.

The above constitutes an algorithm, for the following reasons:

Finiteness
For each iteration through the algorithm, step 3 is executed, which increases the number of elements in $A_0$ by 1 if it doesn't stop.

As $S$ is a finitie set the algorithm will terminate after a finite number of iterations.

Definiteness

 * Step 1: Trivially definite.


 * Step 2: As the edges of a graph can be arranged in order of weight, there is a definite edge (or set of edges) with minimal weight. It is straightforward to select an edge $e$ which does not make a cycle in $T$, by ensuring that at least one end of $e$ is incident to a vertex which has not so far been connected into $T$.


 * Step 3: Trivially definite.


 * Step 4: It is straightforward to determine whether all the vertices are connected.

Inputs
The input to this algorithm is the weighted graph $G$.

Outputs
The output to this algorithm is the minimum spanning tree $T$.

Effective
Each step of the algorithm is basic enough to be done exactly and in a finite length of time.