graph-algorithm/maximum-matching

View on GitHub
src/core/blossom/neighbours.js

Summary

Maintainability
A
0 mins
Test Coverage
export const neighbours = (nvertex, nedge, edges) => {
    const neighbend = [];

    for (let i = 0; i < nvertex; ++i) neighbend.push([]);

    for (let k = 0; k < nedge; ++k) {
        const i = edges[k][0];
        const j = edges[k][1];
        neighbend[i].push(2 * k + 1);
        neighbend[j].push(2 * k);
    }

    return neighbend;
};