The Computational Complexity of the ChordLink Model

. In order to visualize well-clustered graphs with many intra-cluster but few inter-cluster edges, hybrid approaches have been proposed. For example, ChordLink draws the clusters as chord diagrams and embeds these into a node-link diagram that represents the overall structure of the clustered graph. The ChordLink approach consists of four steps; node replication, node permutation, node merging, and chord insertion. In this paper, we focus on the optimization problems defined by two of these steps. We show that the decision version of the problem defined by node permutation is NP-complete and present an efficient algorithm for a special case. For chord insertion, we show that it is NP-complete to decide whether a crossing-free placement of the chords exists. Moreover, it is APX-hard to minimize the number of crossings among the chords. Our results answer an open question posed by Angori, Didimo, Montecchiani, Pagliuca, and Tappini, who introduced ChordLink [TVCG 2021].


Introduction
Node-link diagrams represent an intuitive tool for visualizing graphs.For dense graphs, however, node-link diagrams tend to degenerate into unintelligible hairballs.Less intuitive, but more robust visualization paradigms such as adjacency matrices can be a remedy.In practice, however, large graphs are often "globally sparse" and just "locally dense" [3].This is the case, for example, in social networks such as collaboration and financial networks [4], but also in biological networks [9].For visualizing such graphs, hybrid representations have been invented.In intersection-link representations, for example, each vertex is represented by a geometric object and each edge is either represented by a curve connecting the two objects or, if it belongs to a dense subgraph, by a non-empty intersection of the two objects [1,2].Another example of a hybrid representation is NodeTrix [7], which uses matrices for dense subgraphs and links between the matrices for the global graph structure.ChordLink, recently introduced by Angori, Didimo, Montecchiani, Pagliuca, and Tappini [3], combines very effectively so-called chord diagrams [8] for dense subgraphs, again with links between them for the overall graph structure.In a chord diagram, each vertex is represented by one or several circular arcs, and each edge is a chord between any two arcs that represent the endpoints of the edge.Turning a given node-link diagram into a ChordLink visualization can, for example, be triggered by a user in an interactive system.We now formalize the ChordLink model and the four steps that are performed in order to compute a ChordLink visualization from a node-link diagram.To this end, for a graph G, let V (G) be its vertex set and let E(G) be its edge set.For a positive integer k, let [k] = {1, 2, . . ., k}.
The ChordLink Model.Given a node-link diagram Γ of a graph G, a cluster C ⊆ V (G), and a circle R that contains only the vertices in C (at their positions in Γ), a ChordLink visualization of G locally modifies Γ such that G[C] is drawn as a chord diagram with the vertices of C on R.There are four steps; see Figure 1.
NodeReplication: For each node w ∈ C connected to a node u / ∈ C, create a copy w u of w on the intersection of the edge (w, u) with R, and add the edge (w u , u); see Figure 1b.For each node v ∈ C whose complete neighborhood is contained in C (as the orange square node in Figure 1a), place a copy of v at an arbitrary position on R.
NodePermutation: Copies v u and w u of different nodes v and w that are connected to the same node u / ∈ C can be exchanged in the order of the node copies on R.This step naturally defines the optimization problem NodePermutation, where the aim is to find a permutation of the node copies on R that exchanges only copies connected to the same node outside of R and maximizes the total number of pairs of consecutive copies of the same node; see Figure 1c Angori et al. [3] suggest to minimize the total number of crossings among the chords.(They also suggest maximizing the smallest angle formed by any pair of crossing chords, but we do not consider this here.)This defines the optimization problem CrossingMinimal Chord-Insertion.
Known Results.For NodePermutation, Angori et al. [3] describe a dynamic program that yields optimal solutions if the node copies that are adjacent to the same external node form intervals along R. If this condition does not hold (as in Figure 1b), then they simply split R into maximal pieces where the condition does hold and treat each piece seperately, which yields a heuristic overall solution for the whole instance.Contribution.We focus on the steps NodePermutation and ChordInsertion of the Chord-Link model.First, we prove that NodePermutation is NP-complete; see Section 2. We reduce from VertexCover in cubic graphs.Then, we give an efficient algorithm for NodePermutation for the special case that the neighborhood of C contains only two vertices; see Section 3. Finally, we show that (even a rather special case of) CrossingMinimal ChordInsertion is APX-hard, even if there are only two possible choices for every edge; see Section 4. We reduce from Max-2-SAT.

NP-Completeness of NodePermutation
Above, we have stated NodePermutation as an optimization problem.We now formally define the corresponding decision problem.In the ChordLink model, for every vertex c in the cluster C and each neighbor g ̸ ∈ C of c, a copy of c is placed on the circle R. Since G is simple, each copy can be described as a unique pair (c, g).Abstracting from the original problem, we call c the color and g the group of the pair (c, g).This leads to the following formulation of the problem, where we associate every vertex of C with a distinct color.Let C be a set of colors, let G be a set of groups, and let L = (L 1 , . . ., L n , L 1 ) be a circular list of distinct pairs where, for i ∈ , and let N (L) be the number of pairs of consecutive equal entries of C(L).
Given C, G, L, and an integer K > 0, find a permutation π of L such that (i) G(π(L)) = G(L) and (ii) N (π(L)) ≥ K.Note that requirement (i) ensures that we can permute only elements of L that belong to the same group.
Proof: The problem is in NP since we can verify a permutation easily.
To show hardness, we reduce from 3SetCover.This problem generalizes VertexCover in cubic graphs, which is NP-hard [5].In the decision version of 3SetCover, given a finite universe U (the edge set of the cubic graph), a family S of size-3 subsets of U (for each vertex, its three incident edges), and an integer k > 0, the task is to find a subfamily S ′ (corresponding to a vertex cover) of S of size at most k that covers U .(In the special case of VertexCover, each element of the universe appears in exactly two elements of S.) Given an instance (U, S, k) of 3SetCover, we construct an instance (G, C, L, K) of Node-Permutation such that one is a yes-instance if and only if the other is a yes-instance.Let U = {u 1 , . . ., u n }, S = {S 1 , . . ., S m }, and, for i To construct an instance of NodePermutation, we use only a single color c ⋆ that appears in more than one entry; all other entries have a unique color.Furthermore, we have one group for every u i ∈ U , and there is exactly one entry (c ⋆ , u i ), and we have one additional group z such that there is no entry (c ⋆ , z); the entries with group z basically serve as blockers between the gadgets.The full reduction is as follows: ∈ U , and , c i,5 }, and L 0 = (c ⋆ , u 1 ), (c 1 , z), (c ⋆ , u 2 ), (c 2 , z), . . ., (c ⋆ , u n ), (c n , z) Clearly, this reduction can be performed in polynomial time.Intuitively, every sublist L i that contains a color-c ⋆ entry corresponds to a set S i in a solution S ′ of S. If these sublists contain K consecutive color-c ⋆ entries, then there are 2K elements that are covered by K sets in S ′ , so First, we assume that (U, S, k) is a yes-instance of 3SetCover, that is, there is a size-k subfamily S ′ of S that covers U .We need to construct a permutation π of L such that (i) For each j ∈ [n], let i be the index of an arbitrary set in S ′ that contains u j .Swap (c ⋆ , u j ) in L 0 with an entry in L i with group u j .There is a choice only if u j = u i1 .If (c i,2 , u i2 ) has been or will be swapped with another entry, too, then swap (c ⋆ , u j ) with (c i,1 , u i1 ); otherwise, swap (c ⋆ , u j ) with (c i,4 , u i1 ).This makes sure that all swapped entries in L i are consecutive.In total, we make n swaps.In the resulting permutation of L, the elements of color u form at most k groups of consecutive entries (as S ′ might contain "unnecessary" sets in the decision version).Hence, the number of pairs of consecutive entries with the same color c ⋆ is at least n − k = K.Now assume that (G, C, L, K) is a yes-instance of NodePermutation, that is, there is a permutation π of L such that (i) G(π(L)) = G(L) and (ii) N (π(L)) ≥ K.We have to show that then (U, S) admits a set cover of size k = n − K. Without loss of generality, we can assume that π swaps each color-c ⋆ element of L 0 with a color-c ⋆ element of L 1 ⊕ • • • ⊕ L m (because such a swap does not decrease N (π(L))) and that π does not swap any other entries of L (because swapping group-z elements does not change N (π(L))).Consider the family S ′ of those sets S i ∈ S such that π modifies L i .We claim that (i) S ′ covers U and (ii) Property (i) holds due to our assumption that π swaps all color-c ⋆ entries of L 0 with a sublist L i with i ∈ [m].Thus, every element of U is contained in an element of S ′ .For property (ii), note that the only pairs of consecutive entries with equal color in π(L) are pairs of color-c ⋆ entries in sublists L i .Among the n color-c ⋆ entries, at least K pairs are consecutive.Let K 1 , K 2 and K 3 be the number of sublists L i that contain one, two and three color-c ⋆ entries, respectively.Then we have K 2 + 2K 3 ≥ K and K 1 = n − 2K 2 − 3K 3 .Hence, the total number of sublists L i that contain at least one color-c ⋆ entry is

An Algorithm for a Special Case of NodePermutation
In this section, we describe a linear-time algorithm to solve the optimization version of NodePermutation for the special case that there are only two groups (but an arbitrary number of colors).In the ChordLink model, this corresponds to an arbitrarily large cluster C where the neighborhood of C in V (G) \ C has size 2.
Theorem 2 NodePermutation can be solved in O(n) time for two groups.
Proof: Let G = {x, y}.The goal is to find a permutation π of L that maximizes N (π(L)).
Consider any three consecutive indices i, i + 1, i + 2. Recall that the elements of L are pairwise disjoint.Thus, c π −1 (i) = c π −1 (i+1) implies that g i ̸ = g i+1 .Since there are only two groups, we have either g i+2 = g i or g i+2 = g i+1 , so c π −1 (i+2) ̸ = c π −1 (i+1) .Hence, for any permutation π of L, we cannot have For • ∈ {x, y}, let C • be the set of colors c i such that there exists some list element (c i , •), and let S = C x ∩ C y .We say that the color c j is assigned We can formulate this problem as a maximum independent set problem on a graph G ′ .The graph contains a vertex v ′ i for every pair of consecutive indices i, i + 1 with g i ̸ = g i+1 , and a vertex Hence, if we find an independent set (v ′ i1 , . . ., v ′ i k ) of size k in G ′ , then we can find an assignment of K = min{|S|, k} colors in S to consecutive pairs of indices (i 1 , i 1 + 1), . . ., (i K , i K + 1).By construction, G ′ is either a cycle or a linear forest, so we can find a maximum independent set of G ′ in linear time with a simple greedy algorithm.To obtain a permutation π of L with N (π(L)) = K, we arbitrarily assign the remaining colors of C x and C y to the remaining list elements of types (c i , x) and (c i , y), respectively.2

APX-Hardness of CrossingMinimal ChordInsertion
In this section, we focus on the optimization problem CrossingMinimal ChordInsertion: Given a graph G with at least one copy of each of its vertices placed on a circle R, insert every edge between a copy of each of its endvertices such that the total number of crossings between the edges is minimized.Since the number of crossings only depends on the order of the vertex copies along R, we can also assume them to be drawn as points (rather than circular arcs) on R.
We first prove that finding a crossing-free solution for ChordInsertion is NP-complete.
Theorem 3 It is NP-complete to decide whether a given graph G (with node copies on R) admits a crossing-free solution for ChordInsertion, even if G is a matching and there are at most three copies per vertex.
Proof: Membership in NP is obvious since we can verify an assignment easily.
To show hardness, we reduce from 3-SAT.Let (X , C) be a 3-SAT instance with variables X = X 0 , . . ., X n and clauses C = C 0 , . . ., C m .We create a graph G as follows.The vertex set V (G) contains, for each i ∈ [m], two clause vertices c i and d i ; and, for each j ∈ [n], two variable vertices x j and y j .The edge set E(G) contains for each i ∈ [m], a clause edge (c i , d i ); and for each j ∈ [n], a variable edge (x j , y j ) and a separator edge (z j , z ′ j ).For each j ∈ [n], let T j be the set of clauses that contain the literal X j , and let F j be the set of clauses that contain the literal ¬X j .
To create an instance I of ChordInsertion, we place copies of the vertices of V (G) along R as follows; see Figure 3.For every variable X j , we place, in the given order, 1. the vertex z j ; 2. for every clause C i ∈ T j , a copy d j i of d i , in decreasing order of i; 3. one copy y F j of y j ; 4. for every clause C i ∈ T j , a copy c j i of c i , in increasing order of i; 5. the vertex x j ; 6. for every clause C i ∈ F j , a copy c j i of c i , in increasing order of i; 7. a second copy y T j of y j ; 8. for every clause C i ∈ F j , a copy d j i of d i , in decreasing order of i. 9. the vertex z ′ j ; Assume that I is a yes-instance, i.e., it admits a crossing-free drawing Γ.Then, for each i ∈ [n], the drawing Γ must contain either the chord (x i , y F i ) or the chord (x i , y T i ), simply because x i is unique and y i has exactly two copies; see Figure 4.
Then Γ must contain a chord between a copy of c i and a copy of d i .Because of the seperator edges, whose positions are fixed, this chord cannot connect copies c j i and d k i with j ̸ = k.Next, consider any literal X j contained in C i .Then, the clause edge (c i , d i ) can be drawn as the chord (c j i , d j i ) only if Γ contains the chord (x i , y T i ); otherwise, there would be a crossing between (c j i , d j i ) and (x i , y F i ).Conversely, for any literal ¬X j contained in C i , the edge (c i , d i ) can be drawn as the chord (c j i , d j i ) only if Γ contains the chord (x i , y F i ).Hence, for the edge (c i , d j ) to be drawn in Γ, for at least one of its positive literals X j , there must be the chord (x j , y T j ), or for at least one of its negated literals ¬X j , there must be the chord (x j , y F j ).Thus, we obtain a feasible solution for the 3-SAT instance (X , C) as follows: for each j ∈ [n], if Γ contains the chord (x j , y T j ), then set X j = true, otherwise (Γ contains the chord (x j , y F j )), set X j = false.Since, for each i ∈ [m], the edge (c i , d i ) must be drawn as a chord in Γ, at least one literal in the clause C i must be true, so the solution is feasible.Now assume that (X , C) is a yes-instance, i.e., there exists an assignment ϕ : X → {true, false} such that, for each i ∈ [m], at least one literal of the clause C i is satisfied.We obtain a crossing-free drawing Γ for the corresponding instance I of ChordInsertion as follows.For each separator edge, both its end vertices are unique, so we draw a chord between them.For each j ∈ [n], if ϕ(X j ) = true, we draw the variable edge (x j , y j ) as the chord (x j , y T j ), otherwise as (x j , y F j ).For every i ∈ [m], we choose a satisfied literal X j (or ¬X j ) of the clause C i and draw the clause edge (c i , d i ) as the chord (c j i , d j i ).By construction, this chord cannot intersect the edge (x j , y j ), and, as observed above, it does not cross any other chord.Hence, we obtain a crossing-free drawing Γ for I. 2 In the above proof we reduced from 3-SAT.If we instead reduce from Max-2-SAT, which is APX-hard [6], we can show that our problem is even APX-hard.
Theorem 4 CrossingMinimal ChordInsertion is APX-hard even for matchings with at most two copies per vertex.
Proof: By reducing from Max-2-SAT, the construction in the proof of Theorem 3 can be used to show that CrossingMinimal ChordInsertion is APX-hard even if there are at most two Figure 4: Example of the reduction from 3-SAT to ChordInsertion possible choices for every edge.It is known that Max-2-SAT is inapproximable within any factor greater than 21/22 > 0.954 [6].For the proof, observe that in the construction above a clause is unsatisfied if and only if its corresponding clause edge has a crossing with the variable edge of one of its unsatisfied literals.(In particular, it is never worth for a clause edge to cross separation edges.)Hence, the number of crossings in the optimum solution for the corresponding Crossing-Minimal ChordInsertion instance is exactly the number of unsatisfied clauses in an optimum solution for Max-2-SAT.2

Conclusion
The dynamic program of Angori et al. [3] for NodePermutation insists that all node copies with the same group are consecutive along R. We have described an algorithm that assumes that there are just two groups.Are there other restrictions that render NodePermutation easy and are acceptable in practice?We have shown that CrossingMinimal ChordInsertion is inapproximable within any factor greater than 21/22 > 0.954, but what about a, say, 1/2approximation?
. (The number of such pairs increases by two when going from Figure 1b to Figure 1c.)NodeMerging: Replace each maximal subsequence of consecutive copies of a node w along R by a circular arc c w ; see Figure 1d.ChordInsertion: For each edge (v, w) ∈ G[C], select an arc c v representing v and an arc c w representing w, and insert a chord that connects c v and c w in the interior of R; see Figure 1e.

Figure 1 :
Figure 1: The steps of the ChordLink approach illustrated on the left cluster.

Figure 2 :
Figure 2: Here, the reduction from 3SetCover to NodePermutation yields the cover {S 2 , S 3 }.Color c ⋆ is drawn in blue; all other list entries have their own unique color.List elements of group z are indicated by a •.