Question

In all algorithms, always prove why they work. ALWAYS, analyze the complexity of your algorithms....

In all algorithms, always prove why they work. ALWAYS, analyze the complexity of your algorithms. In all algorithms, always try to get the fastest possible.

A matching M = {ei} is maximal if there is no other matching M' so that M ⊆ M' and M /= M' .

Give an algorithm that finds a maximal matching M in polynomial time. The algorithm should be in pseudocode/plain English. Provide the complexity of the algorithm as well.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Maximal matching for a given graph can be found by the simple greedy algorithn below:

Maximal Matching(G, V, E)

1. M = φ

2.While(no more edges can be added)

2.1 Select an edge,e,which does not have any vertex in common with edges in M

2.2 M = M ∪ e

3. return M

Algorithm 2: Algorithm Maximum Matching

Input : A graph G = (V, E).

Output: A matching M of G.

M = {e} for some e ∈ E(G);

while there is an M-augmenting path in G do

Find an M-augmenting path P of G;

M = (M \ E(P)) ∪ (E(P) \ M);

Output(M);

Add a comment
Know the answer?
Add Answer to:
In all algorithms, always prove why they work. ALWAYS, analyze the complexity of your algorithms....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT