a fast algorithm for enumerating bipartite perfect matchings takeaki uno (national institute of...

16
A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Upload: isaac-warren

Post on 28-Dec-2015

219 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

A Fast Algorithm for Enumerating Bipartite Perfect Matchings

Takeaki Uno (National Institute of Informatics, JAPAN)

Page 2: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

MotivationsGoal: find out general techniques and properties for

speed up enumeration algorithmsSpeeding up discrete algorithms. A lot of studies have been done.Enumeration algorithms: Algorithms have been proposed for various problems.Speeding up enumeration algorithm: Only few studies have been done.

Optimization => find a solutionEnumeration => find many solutions Techniques, structures , and analysis do not work well.

Original techniques for enumeration algorithms are required

Page 3: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Enumeration Problem of Bipartite Perfect Matchings

For a given bipartite graph G = (V, E),

output all the perfect matchings included in G

per matching

Matsui, Fukuda (’93) O(|E|)

I (’97) O(|V|) (amortized analysis)

Minimum weighted perfect matchings

Matsui, Fukuda O(|E||V|)

I (’01: submitting) O(|V|)

This talk: O( log |V|) ( both )

Page 4: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Partition the problem into two subproblems, and solve the subproblems recursively

1. Choose a vertex v

2. E1, E2 = Partition of edges incident to v

3. Solve two subproblems: enumeration of perfect matchings including an edge of Ei for i = 1,2

Subproblem of E1

= problem of ( V, E \ E2 )

Simple Algorithm

E1

E2

v

Page 5: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

To partition the problem, subproblem of ( V, E \ Ei ) has to include at least one perfect matching

For a perfect matching M and a vertex v

1. Find a perfect matching M’ ≠ M

2. E1, E2 = Partition of edges incident to v such that

E1 includes an edge of M

E2 includes an edge of M’

Simple Algorithm 2

MM’v

How to find M’ ?

E1

E2

# iter ≤ 2 # perfect matchings

Page 6: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Use a directed graph DG( G, M )

· Orient edges of M in a direction

· Orient other edges in the opposite direction

A perfect matching M‘ exists a directed cycle is in DG( G, M )

M‘ is obtained by exchanging edges along the cycle

Finding M’ from M

M Operation of an iteration

= Finding a directed cycle

= O( |E|)

Page 7: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Consider speeding up an iteration

· Really take O( |E| ) time? --- in worst case, really take

· Dynamic graph approach --- maintain directed cycle

Similar to transitivity update, O( |V|2 )

· Amortized analysis --- distribute time to subproblems

A graph including a perfect matching requires O( |V|2 ) time

Difficulty of Speed up

Needs of

· improve algorithms

· improve amortized analysis

Page 8: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

“Trimming and balancing“ generalized technique for speeding up

Proposed 3 years ago ( by I ) : Isaac98

· Time complexity analysis and speeding up using the analysis, specialized for enumeration algorithms

· Improved several algorithms, which had not been improved by existing techniques

Page 9: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Corollary of “Trimming and balancing“

For an iteration x of an (recursive type) enumeration algorithm,

T(x) : computation time for x

Chd(x) : Children of x

T* : amortized computation time for an iteration

Tl : maximum computation time of bottom level iterations

If for a constant α >1, for any x,

α T(x) - α ≤ ∑ T(y)       => T* = O ( Tl )                            y Chd(x)∈

If for a constant α > 1 , for any x and its child y ,

αT(y) + α ≥ T(x) => T* = O ( Tl × log ( input size ) )

( we use this here)

Page 10: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

“Trimming and balancing“

Trimming and balancing improves algorithms by adding trimming phase and balancing phase to each iteration

Simple algorithm

· satisfies no these conditions

· Tl = O(|E|)

For each iteration,

add “trimming phase” to decrease Tl → O( 1 )

add “balancing phase” to satisfy T(x)-2 ≤ 4T(y)

Page 11: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Trimming PhasePass reduced graphs to subproblems

Remove edges

· included in all perfect matchings

· included in no perfect matching

→ included in no directed cycle

Contract 3 consecutive edges into an edgeTake O(|E|) time

Reduce to an equivalent problem

On bottom level input graph includes one perfect matching

→ O(1) size graph

→ Tl = O( 1 )

Page 12: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Trimming Phase 2

Lemma For a trimmed graph G = (V, E) a perfect matching M,DG(G, M) includes at least f(G) = |E| - |V| +cc(G) directed cycles(cc(G) : # of connected components of G )

In a trimmed graph G = (V, E) |E| ≥ 1.25|V| → |E| - |V| ≥ 0.2|E|

→ G = (V, E) includes at least 0.2|E| perfect matchings

→ Tl = O( 1 )

Page 13: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Balancing Phase

Set E1 , E2 in arbitrary way

If ( V, E \ Ei ) has few edges after trimming phase,

re-choose E1 , E2

f(G) = |E| - |V| + ( # of connected components of G )

→ ( V, E \ Ei ) can includes few edges but

4 f( ( V, E \ Ei ) ) + 2 ≥ f(G)

Page 14: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Re-choose edge sets

If ( V, E \ Ei ) has few edges after trimming phase

then DG(G, M) includes many edges included in only directed cycles including edges of Ei

E1

E2

Take O(|E|) time

Ei

Page 15: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Analysis

An iteration inputting G=( V, E ) takes

O(|V|+|E|) = O( f(G) ) time

On bottom level, O(|V|+|E|) = O( f(G) ) = O(1) → Tl = O( 1 )

From balancing phase, 4 f( (V, E \ Ei ) ) + 4 ≥ f(G)

From Theorem,

time complexity = O( 1 × log n (=log m) ) per perfect matching

Page 16: A Fast Algorithm for Enumerating Bipartite Perfect Matchings Takeaki Uno (National Institute of Informatics, JAPAN)

Conclusion

Speeded up enumeration algorithm of perfect matchings, using “trimming and balancing”