/* *GivenabipartitegraphconsistingofnodesUnumbered1..nU,nodesV *numbered1..nV,andanadjacencymapofundirectededgesintheform *adjacency[u]=[k,v1,v2,v3,...vk],wewishtofinda"maximum *cardinalitymatching",whichisdefinedasfollows:amatchingisasubset *oftheoriginaledgessuchthatnonodehasmorethanoneedge,anda *matchinghasmaximumcardinalityifthereexistsnoothermatchingwitha *greaternumberofedges. * *Thismatchinghasvariousapplicationsingraphtheory,butthemotivating *examplehereisDilworth'stheorem:apartially-orderedsetcanbedivided *intotheminimumnumberofchains(i.e.subsetsXwherex1<x2<x3...)by *abipartitegraphconstruction.Thisgivesusapolynomial-timesolutionto *theproblemofplanningacollectionofgroupingsetswiththeprovably *minimalnumberofsortoperations.
*/ typedefstruct BipartiteMatchState
{ /* inputs: */ int u_size; /* size of U */ int v_size; /* size of V */ short **adjacency; /* adjacency[u] = [k, v1,v2,v3,...,vk] */ /* outputs: */ int matching; /* number of edges in matching */ short *pair_uv; /* pair_uv[u] -> v */ short *pair_vu; /* pair_vu[v] -> u */ /* private state for matching algorithm: */ short *distance; /* distance[u] */ short *queue; /* queue storage for breadth search */
} BipartiteMatchState;
extern BipartiteMatchState *BipartiteMatch(int u_size, int v_size, short **adjacency);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.