0.1.0 • Published 1 year ago

graphology-color v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Graphology Color

Graph coloring algorithms to be used with graphology.

Issues MIT License

Installation

npm install graphology-color

Usage

color

Colors a graph using a greedy algorithm. The number of colors used is at most one more than the maximum degree of a node in the graph, or at most 5 if the graph is known to be planar.

import { color } from 'graphology-color';

color(graph, { planar: true });

Arguments

  • graph UndirectedGraph\<Colorable>: The target graph. Each node should reserve an integer attribute named color to be written to.
  • parameters ColoringParameters: The parameters determining the method of coloring. Currently, the only method supported is a greedy algorithm for general graphs. Setting the planar option to true for a planar graph will ensure that at most 5 colors are used.

!CAUTION Setting planar to true on a nonplanar graph is likely, but not guaranteed, to throw. Use at your own risk.

0.1.0

1 year ago