Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/include/lib/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  bipartite_match.h

  Sprache: C
 

/*
 * bipartite_match.h
 *
 * Copyright (c) 2015-2025, PostgreSQL Global Development Group
 *
 * src/include/lib/bipartite_match.h
 */

#ifndef BIPARTITE_MATCH_H
#define BIPARTITE_MATCH_H

/*
 * Given a bipartite graph consisting of nodes U numbered 1..nU, nodes V
 * numbered 1..nV, and an adjacency map of undirected edges in the form
 * adjacency[u] = [k, v1, v2, v3, ... vk], we wish to find a "maximum
 * cardinality matching", which is defined as follows: a matching is a subset
 * of the original edges such that no node has more than one edge, and a
 * matching has maximum cardinality if there exists no other matching with a
 * greater number of edges.
 *
 * This matching has various applications in graph theory, but the motivating
 * example here is Dilworth's theorem: a partially-ordered set can be divided
 * into the minimum number of chains (i.e. subsets X where x1 < x2 < x3 ...) by
 * a bipartite graph construction. This gives us a polynomial-time solution to
 * the problem of planning a collection of grouping sets with the provably
 * minimal number of sort operations.
 */

typedef struct 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);

extern void BipartiteMatchFree(BipartiteMatchState *state);

#endif       /* BIPARTITE_MATCH_H */

Messung V0.5 in Prozent
C=71 H=100 G=86

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-08-06) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.