Close
Close window
BipartiteMatching - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

GraphTheory

BipartiteMatching

find maximum matching for bipartite graph

Calling Sequence

BipartiteMatching(G,opts)

Parameters

G

-

undirected bipartite graph

opts

-

(optional) one or more options as specified below

Options

output=list or one of edges, size, or weight.

A list of one or more of the symbols edges, size, and weight, or one of the symbols edges, size, or weight. This determines what is returned by BipartiteMatching. The output is an expression sequence with the corresponding values.

Description

BipartiteMatching(G) returns a maximum matching for a bipartite graph G.

If W is unweighted, the default output is an expression sequence whose first element is the size of a maximum matching and whose second element is the matching itself.

If W is weighted, the default output is an expression sequence whose first element is the weight of a maximum matching of minimum weight and whose second element is the matching itself.

Examples

Perform a simple bipartite matching on an unweighted bipartite graph.

>

withGraphTheory:

>

GGraph1,2,2,3,3,4,3,8,4,5,5,6,6,7

GGraph 1: an undirected graph with 8 vertices and 7 edges

(1)
>

BBipartiteMatchingG

B4,1,2,3,8,4,5,6,7

(2)

Draw the matching in red

>

HighlightEdgesG,B2

>

DrawGraphG,style=bipartite

Compute a minimum-weight maximum matching on a weighted bipartite graph.

>

MMatrix4,4,8,5,2,18,20,24,11,19,25,14,18,15,8,10,14,12

M8521820241119251418158101412

(3)
>

WMMatrix4,M|M%T,Matrix4

WM0000820258000052414100000211181400001819151285218000020241119000025141815000081014120000

(4)
>

GGraphWM

GGraph 2: an undirected weighted graph with 8 vertices and 16 edges

(5)
>

BBipartiteMatchingG

B39,1,8,2,5,3,6,4,7

(6)

Compatibility

The GraphTheory[BipartiteMatching] command was updated in Maple 2021.

The G parameter was updated in Maple 2021.

The output option was introduced in Maple 2021.

For more information on Maple 2021 changes, see Updates in Maple 2021 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /