UNPKG

maximum-matching

Version:

Implementation of Blossom's Algorithm for Maximum Matching

36 lines (35 loc) 1.27 kB
import Graph, { UndirectedGraph } from 'graphology'; import { AugmentingPath } from '../AugmentingPath'; import { Blossom } from '../blossoms/Blossom'; import { Matching } from '../Matching'; import { Node } from '../../graphs/Node'; declare type MatchingNodeAttributes = { isSuperNode?: boolean; }; declare type MatchingEdgeAttributes = { arePaired?: boolean; }; export declare class MatchingGraph extends UndirectedGraph<MatchingNodeAttributes, MatchingEdgeAttributes> { static createFrom(graph: Graph): MatchingGraph; static createCompressing(graph: MatchingGraph, blossom: Blossom): MatchingGraph; pair(node1: Node, node2: Node): void; unpair(node1: Node, node2: Node): void; augmentWith(augmentingPath: AugmentingPath): void; matching(): Matching; pairedNodes(): Node[]; isPaired(node: Node): boolean; unpairedNodes(): Node[]; neighborsThroughUnpairedEdges(node: Node): Node[]; getMate(node: Node): string | undefined; getMateOrFail(node: Node): string; findNeighborOrFail(params: { for: Node; in: Node[]; }): string; compress(blossom: Blossom): void; isSuperNode(node: Node): boolean; private findBlossomNeighbors; private pairedEdges; private edgeOrFail; } export {};