Soft Happy Colouring: Networks, Algorithms & Art
- Soft Happy Colouring is a framework that generalizes traditional happy coloring by allowing partial local consistency through a tunable happiness threshold.
- It leverages combinatorial optimization, metaheuristics, and phase transition analysis to boost community detection accuracy in stochastic block models.
- In computational art, neural architectures use soft colourization techniques to produce gentle, pastel artworks that evoke feelings of happiness.
Soft Happy Colouring refers to a family of relaxed graph colouring problems, algorithms, and palette-design principles arising in both network science and computational art. In the combinatorial-optimization literature, soft happy colouring generalizes “happy colouring” by seeking to maximize the count of vertices satisfied by a relaxed neighbour-consistency criterion, parameterized by a happiness threshold. The concept also has established ties to network homophily and community detection. In computational art, related soft-colouring paradigms exploit neural architectures to generate human-like, soft-shaded colorizations that embody the palette and affective qualities associated with happiness.
1. Mathematical Foundations of Soft Happy Colouring
A soft happy colouring of a (partially) coloured graph formalizes the idea that a vertex should be “locally consistent” with its neighbourhood, but only to a prescribed fractional degree. For a simple graph , vertex colouring , and threshold :
- A vertex is -happy if at least of its neighbours share its colour.
- The soft happy colouring problem seeks a total colouring (respecting any pre-coloured vertices) that maximizes the number of -happy vertices, denoted , or achieves all vertices -happy for specified 0.
This softens the strict 1 happy colouring, allowing a continuous tradeoff between local homogeneity and global partition diversity. The happiness ratio 2 quantifies overall satisfaction.
The problem is NP-hard and models a broad class of real-world coordination and homophily scenarios in networks (Shekarriz et al., 24 Jun 2025, Shekarriz et al., 28 Aug 2025, Shekarriz et al., 16 Feb 2026). Its solutions are connected to planted partitions and block model communities. Notably, the problem generalizes to the case where some vertices are pre-coloured and is solved by extending the colouring while optimizing 3.
2. Connection to Network Homophily and Community Structure
Soft happy colouring provides a rigorous mathematical framework for studying homophily in complex networks: the tendency of similar nodes to cluster together. In stochastic block models (SBM), where graphs are generated with dense intra-community and sparse inter-community edges, the colour classes induced by true communities frequently yield high 4-happiness, particularly below a sharp threshold 5 (Shekarriz et al., 2024, Shekarriz et al., 16 Feb 2026, Shekarriz et al., 28 Aug 2025, Shekarriz et al., 24 Jun 2025).
Three regimes, defined by 6, describe the relationship between homophily optimisation and community detection:
- Mild: 7 — Many partitions can have high 8-happiness, weak community alignment.
- Intermediate: 9 — 0-happy colourings align closely with the SBM communities, enabling accurate community recovery.
- Tight: 1 — Complete 2-happy colourings are asymptotically infeasible with community-sized colour classes.
Threshold theorems further formalize this: as 3, complete 4-happy colourings induced by communities exist with high probability if 5, and fail above this phase boundary.
There is a monotonic relationship (for equal-sized colour classes): larger 6 yields greater community detection accuracy in complete 7-happy colourings (Shekarriz et al., 24 Jun 2025).
3. Core Algorithms and Metaheuristics
A range of heuristics, local searches, and metaheuristics implements soft happy colouring, many focusing on scalability and the exploitation of local density properties (Shekarriz et al., 2024, Shekarriz et al., 24 Jun 2025, Shekarriz et al., 28 Aug 2025, Shekarriz et al., 16 Feb 2026):
| Algorithm | Complexity | Key Principle |
|---|---|---|
| Greedy-SoftMHV | 8 | Assigns all free vertices a colour increasing 9-happiness |
| Neighbour Greedy Colour | 0 | Iteratively colours neighbours of coloured vertices |
| Growth-SoftMHV | 1 | Expands “locally happy” vertex sets group by group |
| Local Maximal Colouring (LMC) | 2 | Assigns to each vertex the colour most frequent among neighbours |
| Local Search (LS) | 3 | Recolours unhappy vertices to most frequent neighbour colour |
| Repeated/Enhanced LS | 4; 5 | Repeated improvement; global best recolouring at each step |
LMC and LS are especially prominent: LMC grows clusters resembling communities without explicit reference to 6, while LS rapidly improves colourings by exploiting local density.
Modern metaheuristics leverage these as initialization/improvement stages within evolutionary or sampling-based global searches (Shekarriz et al., 28 Aug 2025, Shekarriz et al., 16 Feb 2026):
- Genetic Algorithms (GA) and Memetic Algorithms (MA) create populations via LMC/LS, evolve/optimise via crossover, mutation, and local search, achieving statistically superior 7-happiness and community detection accuracy.
- Cross-Entropy with Local Search (CE+LS): Utilizes probabilistic sampling updated on elite solutions, always applying LS for local improvement. CE+LS is robust and yields the best solution quality and scalability, especially in the tight regime where other methods collapse.
Experiments on large SBM benchmarks (up to 28,000 graphs) consistently show the superiority of metaheuristic schemes that integrate fast, structure-sensitive local search.
4. Thresholds and Phase Transitions
Threshold results delineate the regimes where soft happy colouring is feasible or intractable in random-graph models:
- The upper threshold for 8-happy community colourings is given by 9. For 0, complete community-induced 1-happy colouring is w.h.p. achievable (Shekarriz et al., 2024, Shekarriz et al., 24 Jun 2025, Shekarriz et al., 28 Aug 2025).
- For 2, even with equal-sized colour classes, the probability of finding full 3-happiness drops exponentially in 4.
- The lower bound 5 separates trivial solutions from those genuinely associated with community structure.
This phase transition aligns sharply with empirical findings: algorithms can only find complete 6-happy colourings (and thus high community accuracy) below the critical threshold; above it, no known algorithm is effective (Shekarriz et al., 24 Jun 2025, Shekarriz et al., 28 Aug 2025).
5. Empirical and Algorithmic Performance
Systematic benchmarks show:
- LMC has the strongest correlation with community structure among heuristics.
- The best happiness ratios and the highest rates of complete solutions are produced by MAs with LMC initialisation or populations enhanced by local search (Shekarriz et al., 28 Aug 2025).
- The CE+LS hybrid exceeds all prior approaches in maximizing 7-happiness (8 vs. 9 for best MA+RLS(LS)), with performance stable even as 0 or 1 increases (Shekarriz et al., 16 Feb 2026).
- Increasing pre-colouring tightens constraints: LS and LMC maintain near-linear runtime and solution quality as the number of pre-coloured vertices increases (Shekarriz et al., 24 Jun 2025).
- Statistical validation using Welch’s 2-test confirms significance of method performance differences.
Notably, homophily optimisation (maximising 3-happiness) is not always equivalent to best partition recovery: the most homophilic colouring can diverge from the ground-truth community labelling when 4 and class sizes permit (Shekarriz et al., 16 Feb 2026).
6. Computational Art: Soft Happy Colouring in Palette and Affect
In the context of digital art, “soft happy colouring” defines both a palette and a generative procedure for producing artwork evoking happiness through soft, watercolor-like transitions. Neural methods for outline colorization employ dual networks: a coarse color prediction network and a shading network that renders smooth transitions from rough, user-supplied or predicted colour hints (Frans, 2017).
- The tandem architecture, with information reduction (patch dropout/blur) in the colour hints, enables robust, user-friendly soft colourization, yielding outputs with gentle, pleasant shading.
- The approach is robust to messy scribbles or missing hints and produces artwork with soft color gradients, crucial for the perception of "happiness" and "softness".
Empirical studies on color-emotion associations in art demonstrate that “happiness” is most strongly evoked by yellow, supported by orange, green, and beige. Soft happiness is best achieved with pastel variants, reduced saturation, and medium/pale intensities (Muratbekova et al., 2023). The table below summarizes the dominant emotion-palette associations for happiness:
| Color | Happiness Association (%) |
|---|---|
| Yellow | 20.9 |
| Brown | 20.3 |
| Gray | 20.2 |
| Orange | 10.6 |
| Green | 8.8 |
| Beige | 5.7 |
Thus, in artistically and perceptually grounded contexts, soft happy colouring refers to methods, palettes, and representations specifically designed to evoke gentle, positive affect—implemented computationally via fuzzy palette selection or neural generative models (Frans, 2017, Muratbekova et al., 2023).
7. Applications, Limitations, and Future Directions
Applications: Soft happy colouring is applied in network analysis (homophily detection, community inference in SBM and real networks), large-scale graph optimization, digital art and comic generation, and affective computing (emotion-aware tagging, retrieval, and design) (Frans, 2017, Muratbekova et al., 2023, Shekarriz et al., 16 Feb 2026, Shekarriz et al., 28 Aug 2025).
Limitations: Theoretical thresholds limit when full 5-happy colourings are feasible. The objective is distinct from perfect community recovery—solutions maximizing 6-happiness may not be the most accurate community partitions if class sizes are unbalanced or 7 is inappropriate (Shekarriz et al., 16 Feb 2026, Shekarriz et al., 24 Jun 2025). In generative art, neural colourization can exhibit low stylistic diversity or dependence on outline quality (Frans, 2017).
Future Directions:
- Enhancing diversity and semantic alignment in neural soft colourization (Frans, 2017).
- Development of stronger diversity-inducing losses or user-interactive palette guidance in both art and network partitioning (Shekarriz et al., 28 Aug 2025).
- Hybrid metaheuristics and matheuristics, leveraging structure-aware local search components, for scalability and quality improvements (Shekarriz et al., 16 Feb 2026).
- Extending polynomial-time heuristics to more general graph models and constraint regimes (Shekarriz et al., 2024).