| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2014 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include <stdbool.h> |
| 14 |
|
| 15 |
enum { COLOR_RGB, COLOR_GRAY, COLOR_LAB }; |
| 16 |
enum { ERROR_BAD_COLOR_SCHEME = -9 }; |
| 17 |
|
| 18 |
/// for a graph A, get a distinctive color of its nodes so that the color |
| 19 |
/// distance among all neighboring nodes are maximized |
| 20 |
/// |
| 21 |
/// Here color distance on a node is defined as the minimum of color differences |
| 22 |
/// between a node and its neighbors (or the minimum of weighted color |
| 23 |
/// differences if weightedQ = true, where weights are stored as entries of A0. |
| 24 |
/// Accuracy is the threshold given so that when finding the coloring for each |
| 25 |
/// node, the optimal is with in "accuracy" of the true global optimal. |
| 26 |
/// |
| 27 |
/// @param color_scheme rgb, gray, lab, or one of the color palettes in |
| 28 |
/// color_palettes.h, or a list of hex rgb colors separated by comma like |
| 29 |
/// "#ff0000,#00ff00" |
| 30 |
/// @param lightness of the form 0,70, specifying the range of lightness of LAB |
| 31 |
/// color. Ignored if scheme is not COLOR_LAB. |
| 32 |
/// @param A the graph of n nodes |
| 33 |
/// @param accuracy how accurate to find the optimal |
| 34 |
/// @param seed random_seed. If negative, consider -seed as the number of random |
| 35 |
/// start iterations |
| 36 |
/// @param cdim dimension of the color space |
| 37 |
/// @param color On input an array of size n*cdim, if NULL, will be allocated. |
| 38 |
/// On exit the final color assignment for node i is [cdim*i,cdim*(i+1)), in |
| 39 |
/// RGB (between 0 to 1) |
| 40 |
int node_distinct_coloring(const char *color_scheme, int *lightness, |
| 41 |
bool weightedQ, SparseMatrix A, double accuracy, |
| 42 |
int seed, int *cdim, double **colors); |