Evolutionary Computation for Label Layout on Unused Space of Stacked Graphs

Placing numerous objects and their corresponding labels in the stacked graph visualization is a challenging problem. In the stacked graph, different combinations of initial parameters and filtering effects yield views with hidden information, illegible labels, and unused space. The result is a tool that does not take advantage on the unused space to reveal information to the user for further investigation. We present an automatic method for label layout on the unused space in a stacked graph. An evolutionary computation (EC) is used to optimize the best label position according to legibility requirements, as well as requirements for keeping semantic relationships between labels and their representative visual objects. A number of EC experiments, as well as a usability study on label legibility, show that our proposed solution looks promising, as compared to the traditional solutions.


Introduction
Designing effective information visualization systems with abundant associated labels is a difficult task, especially when the screen space is limited.Label layout is an essential task in the field of information visualization to identify the visualized data and different visual objects.The challenge is to find a global labeling solution without any overlapping of other labels.Since labels are used to explain the data, the solution is reduced not only to minimize the overlapping, but also to keep semantic relationships between labels and their corresponding visual objects.The label layout problem, which is proved to be NP-hard, has been extensively studied.In cartographic design, for instance, label legibility is the most important requirement [1].

Related Work
In this paper, we use and extend the stacked graph visualization as proposed in [2,3], where a collection of job occupations is visualized using stripes representing occupation's time series (Figure 1).Since the data values are normalized, the heights of individual stripes add up to the height of the overall graph; thus, there can be no spaces between the stripes because this would distort their sum.In the case of stacked graphs with many occupations, this may cause the individual stripes to be harder to read.The legibility of the data is, indeed, an unsolved design consideration of the stacked graph [4].
Colors have been used to distinguish stripes without using heavy borders [2].Another proposed solution in [2] is to use a threshold for label visibility (TLV), which is the minimum width, in pixels, for a stripe to receive a label.However, in a previous experiment [5], we found that the TLV makes no significant improvement on data legibility.Moreover, as for the obtained results, the lack of labels on some of the stripes was the main reason they found on the stacked graph illegibility.In this work, we use the TLV to compare our proposed system with two versions of the traditional stacked graph.
Maximizing the display of data content in a comprehensible way is a problem that has been addressed by many researchers.Li et al. [6] implemented a set of techniques in LifeLines, a visualization environment as applied to medical patient records.The authors presented algorithms and metrics based on map-oriented techniques.Text labels either overlay visual objects or placed outside (internal versus external labels).Works supporting the idea to use "call-outs"or "leaders" connecting external labels to visual objects can be found on hand-made illustrations, as in [7,8], or for labeling server motherboards, as in [9].
Works on aesthetic layouts to support the legibility of stacked graphs can be found in [4,10].Here, the author's proposal is on the use of different shapes or stripes, as well as coloring.Hartman et al. [11] developed a similar idea with the use of external labels.
Studies on labeling and label legibility have been conducted to support information visualizations.Talbot et al. [12] extended Wilkinsons optimization approach to produce labelings on axis in a two-dimensional graph.Luboschik et al. [13] present a labeling method using fast pointfeature, to support information visualization systems.An interesting experiment on label readability can also be found in [14], where the authors investigated the readability of medication labels.The contributions of this paper are (i) a new component, based on evolutionary computation, for augmenting the readability of labels in the stacked graph visualization, (ii) an adjustment to the PMX crossover operator for permutation of label positions, (iii) an adjustment to the SWAP mutation operator for replacement of label positions, and (iv) a usability study on label legibility proving the effectiveness of our method.

Evolutionary Computation Design
Using a grid layout, the visualization area is divided into a collection of equal partitions.The center point of each partition is the actual absolute position.Each partition has a unique identifier, and those not intersecting with the stacked area-in the unused space-are considered as the candidate partitions.Figure 2 shows the partitions obtained from the stacked graph of Figure 1.A 5 × 8 grid layout (5 rows and 8 columns) was used; leading to 16 candidate partitions (circles colored blue).To support a more efficient solution encoding, candidate partitions are reindexed, for example, in Figure 2 from 0 to 15.
Here, γ n = log 2 n denotes a locus encoding a partial gene evaluation.
The evaluation of the ith gene for the candidate label l i ∈ L will then yield a partition, upon which positioning l i on the unused space.Therefore, all partitions derived from the complete chromosome characterize a label layout for all selected illegible labels.
As an example, consider two layouts represented by the following two chromosomes, where six labels are to be placed on the unused space of the stacked graph of Figure 1, using the partitions of Figure 2: Chromosome A: 0000 0110 0010 1000 0111 1001 Chromosome B: 1001 0101 0110 0011 0001 0010 Our approach is similar to several proposed GAs for reordering or permutation problems.The most famous is the traveling salesman problem (TSP) in which a salesman wants to visit a number of cities while traveling the least possible distance.In the TSP, each city must be represented once and only once; and the fitness of the chromosome is related to the tour length, which in turn depends on the ordering of the cities.Our solution is comparable to the TSP in the encoding method, that is, we prefer partitions to be represented once and only once in the chromosome.This is because their repetitions would lead to overlapping, and thus infeasible solutions.Our label layout problem and TSP differ, however, in the number of encoded elements.In the TSP, all cities are represented in a chromosome, while our solution encodes only a subset of the candidate partitions.This will require an adjustment of the crossover and mutation operators designed for the TSP, which we describe later in the following sections.

Fitness Function.
We decided that the quality of label layout depends on the fitness of candidate partitions for the illegible labels.We enforce appropriate label arrangements on the unused space using the following criteria: F 1 : Minimize the overlapping between labels, F 2 : Maximize the correlation between the label order and the stripe order.
The fitness value for F 1 for individual i is inversely proportional to the number of labels with overlapping: where Φ i is the number of labels, of individual i, with overlapping.Here, two labels are overlapped if the intersection between their bounding boxes is greater than zero.The fitness value for F 2 is proportional to the correlation between the label order and stripe order.For each individual i, we calculate two tuples.A tuple of partition positions (PP) is obtained from the absolute y-coordinates of the encoded partitions, and a tuple of stripe positions (SP) is the order of the L illegible labels under consideration in the current stacked graph.The two tuples are used to reward a correlation ratio between the label order and the stripe order using the following equation: where pc denotes the Pearson product moment correlation coefficient.Note that |PP| = |SP| = |L|.Finally, the total fitness value for indivual i is obtained as where w x is a weighting ratio for criterion F x .

Genetic Algorithm and Genetic
Operators.We used the following genetic algorithm.
(1) Create an initial population of C chromosomes (generation 0) (2) Evaluate the fitness of each chromosome The above algorithm introduces concepts such as crossover and mutation operator.In this work we used the following four operators.
(1) Single Point Crossover (C1).The single point crossover operator is aimed at exchanging bit strings between two parent chromosomes.A random position between 1 and |L|−1 is chosen along the two parent chromosomes, where L is the chromosome's length.Then, the chromosomes are cut at the selected position, and their end parts are exchanged to create two offspring.For instance, the two chromosomes of the previous section are selected to produce two offspring as follows.
parent A: 06|2879 offspring A : 066312 parent B: 95|6312 offspring B : 952879 It should be noted that single-point crossover cannot guarantee representations with no repeated values.
(2) Partially Matched Crossover, PMX, (C2).PMX [15] arose in considering ways to tackle issues associated with the classic traveling salesman problem (TSP).Given two parents A and B, PMX randomly picks two crossover points.The offspring is then constructed in the following way.Starting with a copy of A, the positions between the crossover points are, one by one, set to the values of B in these positions.To keep the string a valid chromosome, the cities in this positions are not just overwritten.To set position p to city c, the city in position p and city c swap positions.Consider the example below of this encoding for the two tours A: 6, 2, 3, 4, 1, 7, 5 and B: Since TSP chromosomes encode all cities, the city in position p and city c can always be exchanged, for example, cities 1, 3, 7 and 4, 1, 7 could be found in the copies of A and B, respectively.In our domain, however, a partition in position p cannot always find its pair within the same parent.So, we propose to solve this by replacing such partition with the one in position p in the other parent.Consider the example below of this encoding for the two chromosomes A: 0, 6, 2, 8, 7, 9 and B: (3) Simple Mutation (M1).The bits of the two offspring generated by the crossover operator are then processed by the mutation operator.This operator is applied to each bit with a small probability (e.g., 0.001).When it is applied at a given position, the new bit value switches from 0 to 1 or from 1 to 0. Here, it should also be noted that the simple mutation operator cannot guarantee representations with no repeated values.
(4) Swap Mutation (M2).Mutation operators for the TSP are aimed at randomly generating new permutation of cities.As opposed to the simple mutation operator, which introduces small perturbations into the chromosome, the permutation operators for the TSP often greatly modifies the original tour.One example is the swap mutation operator, where two cities are selected and swapped (i.e., their positions are exchanged).
Since TSP chromosomes encode all cities, the selection of two of them is always possible.In our domain, however, there may be cases where this is not possible.Here, as part of our second adjustment, we propose to perform this selection by choosing one partition from the chromosome, and the other from the set of candidate partitions P. The latter is randomly selected until a chromosome with no repeated values can be formed.Then, this partition replaces the one in the chromosome.

Experiments
Aiming at solving the overlapping problem among labels (w 1 = 1, w 2 = 0), our goal here was to compare the performance of the four combinations C1M1, C1M2, C2M1, and C2M2, all in terms of the time required to find a solution and the quality of the solution obtained.In order to be fair to the four operators, as well as to be thorough in our experiment, we compared the results among combinations using scaled problems through the use of different grid layout resolutions.
4.1.Experimental Setup.We selected 25 illegible labels describing job occupation names from the view of Figure 1.
The illegibility criterion was based on font size, where the smaller the font size, the most illegible the label.These labels have different lengths and, thus, different bounding boxes.
To improve their legibility, we increased by 40% the base minimum size of each label.We also used five different grid layouts for partitioning the visualization area, 10×10, 12×12, 14 × 14, 16 × 16, and 18 × 18; leading to 34, 49, 71, 97, and 134 candidate partitions, respectively.As for crossover operators, we used single point (C1) and the adjusted PMX crossover (C2), both using a crossover rate of 0.6.As for mutation operators, we used simple (M1) and the adjusted swap mutation (M2), both using a mutation rate of 1/|L| .Finally, we used the following five different values for C (population size): 25,50,75,100,125.All candidate partitions, genetic operators (C1, C2, M1, M2), and population sizes were combined to produce 100 types of parameter selections for running the genetic algorithm.We call each type a "configuration."Thus, for this experiment, we have the configuration tuples (conf1,34,C1,M1,25),. .., (conf4,34,C2,M2,25),. .., and (conf100,134,C2,M2,125).To produce a fair comparison among configurations, we reuse populations and create new ones at given intervals.Since populations can be reused only for tuples with the same number of candidate partitions, a new random initial population is created when the configuration number is a multiple of 4, otherwise, it is reused.Finally, each configuration was run using 500 generations, and all reported values are the results of 10 independent runs.

Results
. Two metrics were used to measure the results.
QS 2 : Difference between QS 1 and the initial fitness value.
(2) Convergence Speed (CS n ) CS 1 : Best-fitness average of all generations [16] 1 CS 2 : Difference between CS 1 and the initial fitness value.
Since we have different initial fitness values (25 in total), QS 2 and CS 2 will let us know the quality and convergence speed, respectively, of the solutions with respect to the evolution of populations.
In terms of QS 1 , the best configuration was obtained from a grid layout of 14 × 14 (71 candidate partitions), population size C of 50 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with a fitness average of QS 1 = 0.944, as shown in Table 2.
In terms of QS 2 , the best configuration was obtained from a grid layout of 16×16 (97 candidate partitions), population size C of 25 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with an improvement of QS 2 = 0.448.
In terms of both CS 1 and CS 2 , the best configuration was obtained from a grid layout of 14 × 14 (71 candidate partitions), population size C of 125 individuals, adjusted PMX crossover (C2), and adjusted SWAP mutation (M2); with a convergence speed CS 1 = 0.849 and CS 2 = 0.329.
Our results show that our proposed operators, in this domain, outperform the standard ones.Also, as from our observations of the second and the third best results, the combination C2M2 outperforms, 99% the time, the other two operators.Another observation is that our best results of C2M2 were concentrated on configurations sharing the grid layout 14 × 14 (71 candidate partitions).This suggests that our proposed method has no significant improvement by increasing the number of candidate partitions.Since we were also interested in the time required to obtain the best solution, we also observed the convergence speeds of our proposed method.Here, the convergence speed of the best QS 1 , CS 1 = 0.841, is the third best convergence speed.Moreover, it has no significant difference with the best convergence speed CS 1 = 0.849.This number is associated to the group of 71 candidate partitions (14 × 14) and was also obtained from the combination C2M2.In general, this can be explained by the variations in the number of individuals 50 ≤ C ≤ 125, which confirms previous results, such as those of De Jong test functions [16].
Figure 3 shows the performance comparison among C1M1, C2M2, C2M2, and C2M2.Best fitness value versus generation number is plotted for all configurations.The experiment has been repeated 10 times to plot average values, using different maximum generation numbers.Because of space limitations, the plots for only the best QS 1 , QS 2 , CS 1 , and CS 2 are given.
Figure 4 shows contour plots, where the best results for the three variables (i) populations size, (ii) candidate partitions, and (iii) fitness value, are shown.It can be observed that where M2 is used, better fitness values are obtained, and also lower numbers of individuals are required, which suggests better computational performance.Moreover, where the combination C2M2 was used, the best fitness values were obtained.
Figure 5 shows stacked graph views produced by our genetic algorithm.Figure 5(a) show the result of experiment 3 d), as applied to Figure 1, where the weights w 1 = w 2 = 0.5 was used.Figure 5(b) and Figure 5(c) show the results of views with prefixes "C" and "F", respectively.

Usability Study
We conducted a usability study with 30 subjects to investigate the readability of labels using 9 views extracted from 3 different versions of the stacked graph visualization.Our goal here was to compare the performance of the three versions, all in terms of subject reading speeds, as well as subject accuracy.

Subjects.
Participants in this study were computer science students taking courses at our university and consisting of 23 undergraduate students and 7 graduate students with the average age of 22.17, ranging from 20 to 26 years old.All subjects were selected from a test on stacked graph usage using a questionnaire for visual tasks [17].The scores obtained from the task were used to divide the subjects into three groups; where each group contains 4 subjects with high score, 3 with score average, and 3 with low score.To avoid bias from ordering effects, each subject group was tested using different version orderings.

Material.
The materials used were as follows.
(I) Three versions of the stacked graph visualization.
(II) Nine views obtained from the three aforementioned versions; three views from each version, from which the first group, view a, corresponds to the views with prefix "A" Figure 5(a), the second group, view c, to the prefix "C" Figure 5(b), and the third group, view f, to the prefix "F" Figure 5(c).
(III) Twenty five illegible labels for each prefix, with variations in their font size.
The between-subject factor was version ordering (V1V2V3, V2V3V1, V3V1V2), and the within-subject factor was view prefix (view a, view c, view f).

5.4.
Procedure.We prepared a task involved in searching, using the features of the visualization system, for labels with different levels of legibility.Six labels, describing occupation   names, were to be found using the mouse hovering feature of the stacked graph, where an information box was shown to the subjects while they were moving the mouse on the visualization area.For this experiment, subjects could see in the information box both the searched label and its corresponding population number; as shown in the views of Figure 5.In the beginning, each participant was given a questionnaire containing the question "what is the population number for each of the following occupation names?" and six occupation names, sorted from easy to difficult in terms of legibility.Subjects had a limited time of one minute to write their answers.significant main effects among stacked graph versions and view prefixes.
Speed tests indicate that V1 and V2 required significantly more time to read than V3 (P < 0.05).Similarly, subject error data indicated significant main effects among stacked graph versions.Accuracy tests indicated that more errors were committed with V1 and V2 than with V3 (P < 0.05).
A similar ANOVA of speed test indicated significant main effects among view prefixes when V2 is used (P < 0.05), that is, with this version some views will require lower time to read, but with some views, longer time.Here, we hypothesize that subjects, on some views, were able to find answers even if labels were overlapped.On the other hand, the same test indicated that there are no significant differences among view prefixes when V1 and V3 are used (P < 0.05).That is, if V1 is used, longer time will be required to find labels.If V3 is used, however, users will require significantly lower time to find them.
Interestingly, a similar ANOVA of subject accuracy showed an equivalent result as those in the previous para-graph.Subject error data indicated significant main effects among view prefixes when V2 is used (P < 0.05), that is, with this version, the accuracy of users in their findings will be moderately high only on some views.On the other hand, the same test indicated that there are no significant differences among view prefixes when V1 and V3 are used (P < 0.05).That is, if V1 is used, the accuracy of users will always be low.If V3 is used, however, users will show significantly high accuracy.Figure 6 shows a comparison results of the conducted usability study.

Conclusions
In this paper, we intended to highlight the stacked graph as an interesting object of study.We have suggested an evolutionary computation for label layout on the unused space, where a method for maximizing the display of labels is proposed.An important purpose is to improve the legibility of the stacked graph by revealing to the users more information for further analysis.We developed a genetic ISRN Artificial Intelligence algorithm which computes two fitness functions, one for solving the overlapping problem, and the other for keeping order correlations among labels and their corresponding visual objects.Our algorithm was inspired by previous solutions for ordering and permutation problems.Here, however, we adjusted two standard genetic operators in order to solve a similar problem in the stacked graph.
As for our usability study, our method proved to be successful.Our statistical analysis results, as well as our observations, showed that our stacked graph version outperformed the traditional ones.It is clear that solving the overlapping problem contributes to improve the legibility of the visualization, however, more investigation is needed to know how effective the correlation among labels and their visual objects are, as a semantic relationship, and useful for visual analysis tasks.For this, we believe that a different user experiment should be designed.

Figure 1 :
Figure 1: Stacked graph view (left) showing 40 job occupation names starting with the prefix "A", and TLV = 0 pixels.A number of labels are illegible due to either overlapping or small size.The solid line encloses the visualization area, and the dotted line the unused space.At the right, an increased section of the same view (top) with TLV = 12 pixels (some labels are hidden).The same section (bottom) can be seen with TLV = 0 (some labels are overlapped) and with their minimum font size increased three times. 08

Figure 2 :
Figure 2: Partition of the visualization area of the stacked graph of Figure 1.Partitions in blue color correspond to the candidate partitions for label layout.

( 3 )( 5 )( 6 ) 8 )( 9 )
Select the fittest chromosome (4) Excluding the chromosome selected in step 3, select C−1 parents from the current population via roulette wheel selector Choose at random a pair of parents for mating.Apply crossover operator Process each offspring by the mutation operator, and insert the new offspring into the new population (7) Repeat steps 5 and 6 until C − 1 offsprings are created (Replace the old population of chromosomes with the new population Add the chromosome selected in step 3 into the new population (10) Evaluate the fitness of each chromosome in the new population (11) Increase the generation number and go back to step 3 if this number is less than some upper bound.

Figure 3 :
Figure 3: Performance comparison among C1M1, C1M2, C2M1, and C2M2.Best fitness value versus generation number is plotted for three configurations.

Table 2 :
Comparison of configurations C1M1, C1M2, C2M1, C2M2 on five different numbers of candidate partitions (left side) and five numbers of population sizes.The best result among candidate partitions is emphasized in boldface.For each candidate solution number, the first row corresponds to the