mosp LEDA Extension Package  0.7
Functions
Popular Matchings

Functions

bool mosp::BI_POPULAR_MATCHING (const leda::graph &G, const leda::list< leda::node > &A, const leda::list< leda::node > &B, const leda::edge_array< int > &rank, leda::list< leda::edge > &L)
 Compute a popular matching. More...
 
bool mosp::BI_APPROX_POPULAR_MATCHING (const leda::graph &G, const leda::list< leda::node > &A, const leda::list< leda::node > &B, const leda::edge_array< int > &rank, int maxphase, leda::list< leda::edge > &L, int &phase)
 Compute an approximate popular matching. More...
 
bool mosp::BI_APPROX_POPULAR_MATCHING (const leda::graph &G, const leda::list< leda::node > &A, const leda::list< leda::node > &B, const leda::edge_array< int > &rank, leda::list< leda::edge > &L, int &phase)
 Compute an approximate popular matching. More...
 
bool mosp::BI_UNPOPULARITY_FACTOR (graph &G, const list< node > &A, const list< node > &B, const edge_array< int > &rank, const list< edge > &M, int &factor)
 Compute the unpopularity factor of a matching. More...
 
bool mosp::BI_POPULAR_CAPACITATED_MATCHING (const graph &G, const list< node > &A, const list< node > &B, const edge_array< int > &rank, const node_array< int > &capacity, list< edge > &L)
 Compute a popular matching in a capacitated instance. More...
 
int mosp::BI_UNPOPULARITY_MARGIN (graph &G, const list< node > &A, const list< node > &B, const edge_array< int > &rank, const list< edge > &M)
 Compute the unpopularity margin of a matching. More...
 

Detailed Description

Function Documentation

bool mosp::BI_APPROX_POPULAR_MATCHING ( const leda::graph &  G,
const leda::list< leda::node > &  A,
const leda::list< leda::node > &  B,
const leda::edge_array< int > &  rank,
int  maxphase,
leda::list< leda::edge > &  L,
int &  phase 
)

Compute an approximate popular matching.

During the algorithm the graph is copied and everything happens on the copy.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
maxphaseThe maximum phase that the algorithm will try to compute a matching. As you increase the phases the matching's popularity will drop but the chance of finding a matching that is approximate popular increases.
LA list of edges which after the algorithm will contain the computed matching.
phaseA value which contains the number of phases that the algorithm needed to compute the resulting matching. It will be at most the value of the parameter maxphase.
Returns
True if the matching is popular, false otherwise.
bool mosp::BI_APPROX_POPULAR_MATCHING ( const leda::graph &  G,
const leda::list< leda::node > &  A,
const leda::list< leda::node > &  B,
const leda::edge_array< int > &  rank,
leda::list< leda::edge > &  L,
int &  phase 
)

Compute an approximate popular matching.

During the algorithm the graph is copied and everything happens on the copy.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
LA list of edges which after the algorithm will contain the computed matching.
phaseA value which contains the number of phases that the algorithm needed to compute the resulting matching. A value of 2 means that the algorithm found a popular matching.
Returns
True if the matching is popular, false otherwise.
bool mosp::BI_POPULAR_CAPACITATED_MATCHING ( const graph &  G,
const list< node > &  A,
const list< node > &  B,
const edge_array< int > &  rank,
const node_array< int > &  capacity,
list< edge > &  L 
)

Compute a popular matching in a capacitated instance.

During the algorithm the graph is copied and everything happens on the copy.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
capacityNode capacities.
LA list of edges which after the algorithm will contain the computed matching. Undefined if no popular matching exists.
Returns
True if the matching is popular, false otherwise.
Precondition
Capacities of the left side of the graph have to be 1, capacities of the right side have to be positive.
The graph must be bipartite
bool mosp::BI_POPULAR_MATCHING ( const leda::graph &  G,
const leda::list< leda::node > &  A,
const leda::list< leda::node > &  B,
const leda::edge_array< int > &  rank,
leda::list< leda::edge > &  L 
)

Compute a popular matching.

During the algorithm the graph is copied and everything happens on the copy. The algorithm has a running time of $O(\sqrt{n}m)$.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
LA list of edges which after the algorithm will contain the computed matching.
Returns
True if the matching is popular, false otherwise.
bool mosp::BI_UNPOPULARITY_FACTOR ( graph &  G,
const list< node > &  A,
const list< node > &  B,
const edge_array< int > &  rank,
const list< edge > &  M,
int &  factor 
)

Compute the unpopularity factor of a matching.

The unpopularity factor is based on the definition with the multiplicities. See McCutchen 2007.

This function might change the order of the graph edges in the adjacency lists.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
MThe matching to test in the following form. A list of edges.
factorContains the unpopularity factor if it is finite. Undefined otherwise.
Precondition
All edges are directed from A to B.
The adjacency lists of the graph must be sorted according to the rank parameter. This means that in LEDA someone has to call G.sort_edges( rank ) before calling this function.
Returns
True if the matching has a finite unpopularity factor, false if infinite.
int mosp::BI_UNPOPULARITY_MARGIN ( graph &  G,
const list< node > &  A,
const list< node > &  B,
const edge_array< int > &  rank,
const list< edge > &  M 
)

Compute the unpopularity margin of a matching.

See McCutchen 2007.

This function might change the order of the graph edges in the adjacency lists.

Parameters
GA bipartite graph.
AThe list of nodes on the left side of the bipartite graph.
BThe list of nodes on the right side of the bipartite graph.
rankAn edge array. Each entry corresponds to the rank of an edge.
MThe matching to test as a list of edges.
Precondition
All edges are directed from A to B.
Returns
The unpopularity margin