Finding happiness: An analysis of the maximum happy vertices problem

https://doi.org/10.1016/j.cor.2018.11.015Get rights and content

Highlights

  • Determines a number of upper and lower bounds.

  • Shows how problems can be broken up into smaller subproblems.

  • Identifies where â; difficult to solveâ; problems reside.

Abstract

The maximum happy vertices problem involves determining a vertex colouring of a graph such that the number of vertices assigned to the same colour as all of their neighbours is maximised. This problem is trivial if no vertices are precoloured, though in general it is NP-hard. In this paper we derive a number of upper and lower bounds on the number of happy vertices that are achievable in a graph and then demonstrate how certain problem instances can be broken up into smaller subproblems. Four different algorithms are also used to investigate the factors that make some problem instances more difficult to solve than others. In general, we find that the most difficult problems are those with relatively few edges and/or a small number of precoloured vertices. Ideas for future research are also discussed.

Introduction

Problems that involve the colouring of graphs come in many guises including vertex colouring, edge colouring, face colouring, precolouring, list colouring, dynamic colouring, and equitable colouring (Lewis, 2016). Such problems typically involve assigning colours to particular elements of a graph such that elements deemed to be “conflicting” are given different colours. Perhaps the most well-known of these problems is the vertex colouring problem where, using a limited set of colours, each vertex of a graph needs to be assigned to a colour such that no pair of adjacent (conflicting) vertices are given the same colour. This has applications in many timetabling, logistical and scheduling problems, where sets of conflicting entities such as tasks, events, or people need to be efficiently allocated to a limited set of resources (Carter, Laporte, Lee, 1996, Lewis, 2016, Lewis, Thompson, 2015, McCollum, Schaerf, Paechter, McMullan, Lewis, Parkes, Di Gaspero, Qu, Burke, 2010).

In recent times, interest has been growing in graph colouring problems where adjacent entities need to be assigned to the same colour, as opposed to different colours (Agrawal, 2018, Aravind, Kalyanasundaram, Swami Kare, Lauri, 2017, Li, Zhang, 2015, Misra, Vinod Reddy, 2018, Zhang, Jiang, Li, 2015). In the case of vertex colouring, this can be useful in areas such as social networking, where we might be interested in assigning groups of related people (vertices) to the same resource, such as a team or a task. Recent studies have also looked at how we might design seating plans for large social gatherings such as weddings, where the aim is simultaneously place people with their friends, but apart from their adversaries (Bellows, Luc Peterson, 2012, Lewis, Carroll, 2016).

In a recent paper, Li and Zhang (2015) introduced the notion of vertex “happiness”. Let Γ(v) denote the set of vertices adjacent to a vertex v.

Definition 1

Let G=(V,E) be a simple graph and let c:V{1,,k} be a colouring of all vertices in G. A vertex u ∈ V is happy if c(u)=c(v) for all v ∈ Γ(u); else it is unhappy.

In other words, a vertex is considered happy if and only if it is assigned to the same colour as all of its neighbouring vertices, otherwise it is unhappy. This naturally gives rise to the following optimisation problem:

Definition 2

The maximum happy vertices (MHV) problem takes an undirected graph G=(V,E) with n vertices and m edges, an integer k, a subset of vertices V′⊆V where |V′| ≥ k, and a partial colouring c:V{1,,k} such that i{1,,k},vV:c(v)=i. The goal is to extend c to a total colouring c˜:V{1,,k} such that the number of happy vertices is maximised.

In this definition, the vertices contained in V′ are the problem’s precoloured vertices; otherwise they are free vertices, belonging to the set VV. Free vertices are originally uncoloured, but will all need to be coloured in the final solution.

As stated in Definition 2, it is necessary that each colour is used at least once in the partial colouring c. Precoloured vertices can themselves be happy or unhappy—indeed, their status could even be determined by c before any of the free vertices have been coloured. Once a total colouring of G has been defined, the number of happy vertices is denoted by H(G) where, 0 ≤ H(G) ≤ n. The optimum (maximum) number of happy vertices in a graph G is denoted by H(G)*.

An example problem instance and candidate solution to the MHV problem is shown in Fig. 1. This illustrates that the problem can also be seen as one of partitioning: as input, we take a set of nonempty colour classes {V1,V2,,Vk} such that i=1kVi=V and vVic(v)=i. Our task is to assign the free vertices to the k colour classes such that H(G) is maximised, i=1kVi=V, and ViVj=ij. The example solution in Fig. 1 may therefore be written as {{v1, v2, v3, v4}, {v5, v6, v7, v8}}.

A practical application of the MHV problem can occur where we have a set people, some of whom have been preassigned to groups for a team building exercise. The remaining people then also need to be assigned to these groups such that the maximum number of people are happy (i.e., in a group containing all of their friends). Similarly, it could arise when seeking to assign these people to dormitories or hotel rooms. The problem also has more general applications in cluster analysis, where some objects are preassigned to clusters, and the task is to assign the remaining objects to clusters such that strongly related objects occur in the same cluster (Everitt et al., 2011). Let us note, though, that although this problem may somehow sound like the “opposite” of a vertex colouring problem, we cannot tackle it by simply producing a proper colouring of the complement of G, as this simply leads to a solution in which nonadjacent pairs of vertices are never assigned to the same colour.

As mentioned, the MHV problem was originally proposed by Li and Zhang (2015). In their paper, the authors also considered the related Maximum Happy Edge (MHE) problem, which involves colouring vertices of a graph such that the number of “happy edges” (i.e., edges with endpoints of the same colour) is maximised. They first showed that the MHE problem with k ≥ 3 is NP-complete by demonstrating a polynomial reduction from the three terminal cut problem. The MHV problem was itself then shown to be NP-complete by showing that MHE ∝ MHV. It was also shown that both problems are polynomially solvable for k ≤ 2.

In subsequent work, Aravind et al. (2016) went on to show that the MHE and MHV problems are polynomially solvable for cycle-free graphs (trees). Later, Aravind et al. (2017) proved that both problems also remain NP-complete for general bipartite graphs (for k ≥ 3) and that the MHV problem is hard for split graphs. It is now also known that both problems are polynomially solvable when G has bounded treewidth or bounded neighbourhood diversity (Agrawal, 2018, Aravind, Kalyanasundaram, Swami Kare, Lauri, 2017).

To our knowledge, three approximation algorithms for the MHV problem on general graphs have previously been suggested in the literature. In their original paper, Li and Zhang (2015) proposed two single-parse constructive algorithms for the problem with approximation ratios of 1/k and Ω(1/Δ3). These are considered in more detail in Section 2. More recently, Zhang et al. (2015) presented an algorithm with an approximation ratio of 1/(Δ+1) that operates by solving a simple linear programming relaxation of the MHV problem. If the solution produced for this relaxation happens to be integral, then it corresponds to the optimum solution; more likely, however, is that the solution is fractional, in which case the non-integer decision variables are rounded via an iterative process to produce an approximate solution.

Given a total colouring of a graph, observe that the removal of an edge can either maintain or increase the current number of happy vertices, but that the addition of an edge can only maintain or decrease the number of happy vertices. Intuitively, this suggests that optimum solutions for dense graphs will tend to feature fewer happy vertices than those of sparse graphs. In this paper we confirm this by taking the linear programming ideas of Zhang et al. (2015) a step further by implementing and testing a more compact integer programming (IP) formulation for the MHV problem. In Section 2 we start by reviewing the two constructive algorithms for the MHV problem. In Section 3 we then use these to help derive a number of bounds for the problem, before describing a way of subdividing problem instances in Section 4. Section 5 then contains our IP formulation together with results from a large set of experiments that demonstrate the characteristics that contribute towards making a problem difficult to solve. A CMSA algorithm that extends this IP formulation is then also proposed to help investigate the affects of problem size. Section 6 concludes the paper and conducts further discussions.

Section snippets

Constructive algorithms

As mentioned, Li and Zhang (2015) previously proposed two single-parse constructive algorithms for the MHV problem. In this section we now review these in detail, particularly because they will be used as a point of comparison later in this paper. The first algorithm, Greedy-MHV, operates by simply assigning all free vertices to colour 1 before calculating the resultant number of happy vertices. This is then repeated using colours 2,,k, and the best of these k solutions is taken. This

Bounds for the MHV problem

In this section we give some bounds on the number of happy vertices that are achievable for various graphs. Lower bounds are derived by considering the behaviour of the Greedy-MHV algorithm and a simplified variant, while upper bounds are generated using the concept of unhappy paths, given in Definition 5 below.

Problem subdivision

In this section we show how instances of the happy colouring problem can be broken up into smaller components, allowing the algorithm of choice to be applied to each component separately. These sub-solutions can then be merged into a single solution for the entire graph.

Firstly, observe that if we have a disconnected graph G comprising multiple components C1,,Cl then the happiness (or otherwise) of a vertex in one component can have no influence on the status of vertices in another component.

Experimental analysis

In this section we now conduct an empirical analysis of the MHV problem. In particular, we use an IP formulation together with the Greedy-MHV and Growth-MHV algorithms to identify features that make instances of this problem difficult to solve. In addition, Section 5.4 also proposes a CMSA algorithm for tackling larger instances of this problem. All experiments reported here were performed on single-threaded 2.80 GHz processors using 5GB RAM. Copies of our source code and problem instance

Conclusions and further work

This paper has analysed a number of features of the maximum happy vertices (MHV) problem, including methods for generating bounds and for breaking up problems. We have demonstrated empirically that difficult-to-solve problems only really occur when graph density and/or the proportion of precoloured vertices is low, which results in graphs with higher numbers of potentially happy vertices. These patterns have been observed to be quite consistent across different values of k and for both random

Acknowledgements

This research was partially supported by the Cardiff University International Collaboration Seedcorn Fund. It was also supported in part by the Monash eResearch Centre and eSolutions-Research support services through the use of the MonARCH HPC cluster. The authors are also grateful for the comments of the reviewers, which helped to improve the paper.

References (18)

There are more references available in the full text version of this article.

Cited by (32)

  • Recombinative approaches for the maximum happy vertices problem

    2022, Swarm and Evolutionary Computation
    Citation Excerpt :

    Here, we extend the results of Lewis et al. [3] by noting how certain edges in an MHV problem instance can be classified as redundant and therefore removed from the graph. Previous approaches, including IP, tabu search and CMSA have shown to be reasonably effective with the MHV problem [3,5]; however, they all have some inherent limitations. IP, as an exact approach, has the benefits of providing a certificate of optimality (or infeasibility if no solution exists) [22].

  • Parameterized algorithms for the Happy Set problem

    2021, Discrete Applied Mathematics
View all citing articles on Scopus
View full text