# maximal-independent-set **Repository Path**: ArkTSCentralRepository/maximal-independent-set ## Basic Information - **Project Name**: maximal-independent-set - **Description**: Maximal independent vertex sets - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-01 - **Last Updated**: 2026-04-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # maximal-independent-set 基于[maximal-independent-set](https://www.npmjs.com/package/maximal-independent-set)原库0.0.0版本进行适配 > Finds a [maximal independent vertex set](http://en.wikipedia.org/wiki/Maximal_independent_set). No guarantees that it is [maximum](http://en.wikipedia.org/wiki/Independent_set). ## Install ```sh ohpm install maximal-independent-set ``` ## Example ```typescript import independentSet from "maximal-independent-set"; let res = new Uint8Array(4); res[0] = 1; res[2] = 1; expect(independentSet([[1, 3], [0, 2], [3, 1], [0, 2]])).assertDeepEquals(res); ``` ## `require("maximal-independent-set")(adjacency_list[, result])` Given a graph encoded as an adjacency list, compute a maximal independent vertex set (aka vertex packing). * `adjacency_list` is an array with length = number of vertices, where each ith entry is an array representing the neighbors of vertex i. If your graph is encoded as an edge list instead of an adjacency list, you can use the [`stars`](https://npmjs.org/package/stars) npm module to make the necessary conversion. * `result` is an optional array that gets the result of the independent set. If not specified, a new Uint8Array is created. **Returns** A vector whose ith entry determines whether the vertex is contained in the independent set or not ## Credits (c) 2013 Mikola Lysenko. MIT License