# Maximum Weighted Matching with Few Edge Crossings for 2-Layered Bipartite Graph

Let c denote a non-negative constant. Suppose that we are given an edge-weighted bipartite graph G=(V,E) with its 2-layered drawing and a family X of intersecting edge pairs. We consider the problem of finding a maximum weighted matching M* such that each edge in M* intersects with at most c other edges in M*, and that all edge crossings in M* are contained in X. In the present paper, we propose polynomial-time algorithms for the problem for c=1 and 2. The time complexities of the algorithms are O((k+m)log n) for c=1 and O(m^4log n+k^3+n(k^2+log n)) for c=2, respectively, where n=|V|, m=|E| and k=|X|.

## Authors

• 7 publications
• 1 publication
• 1 publication
02/14/2020

### A Simple 1-1/e Approximation for Oblivious Bipartite Matching

We study the oblivious matching problem, which aims at finding a maximum...
03/25/2019

### A Weighted Approach to the Maximum Cardinality Bipartite Matching Problem with Applications in Geometric Settings

We present a weighted approach to compute a maximum cardinality matching...
09/18/2019

### A polynomial time approximation schema for maximum k-vertex cover in bipartite graphs

The paper presents a polynomial time approximation schema for the edge-w...
08/30/2017

### Planar Drawings of Fixed-Mobile Bigraphs

A fixed-mobile bigraph G is a bipartite graph such that the vertices of ...
10/09/2017

### Rainbow matchings in properly-coloured multigraphs

Aharoni and Berger conjectured that in any bipartite multigraph that is ...
11/15/2019

### Weighted Triangle-free 2-matching Problem with Edge-disjoint Forbidden Triangles

The weighted T-free 2-matching problem is the following problem: given a...
11/18/2018

### How many matchings cover the nodes of a graph?

Given an undirected graph, are there k matchings whose union covers all ...
##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Let denote an edge-weighted bipartite graph, where is the bipartition of the entire vertex set and is the edge set. Denoting by and , we let , , and . We abbreviate into for simplicity. The edge weight is given by a function . A subset of edges is called a matching if no two edges in share an endpoint in common. Denoted by , the weight of a matching is defined as the sum of edge weights over , i.e., .

A -layered drawing [2, 17, 19] of a bipartite graph is a 2D drawing of such that and are put on two horizontal lines as distinct points from left to right, respectively, and that every edge is drawn as a straight line segment between the endpoints. Two edges and make a crossing or intersect if either ( and ) or ( and ) holds.

In our research, we study the problem of computing a maximum weighted (max-weighted for short) matching under a constraint such that only a small number of edge crossings are admitted. The constraint we take up here is that each matching edge may intersect with at most other matching edges, where is a non-negative constant.

We formulate the problem in a more general setting. For , we call a crossing pair if and make a crossing. Let denote the set of all crossing pairs in . For input, we accept a subset as well as and , where is the set of crossing pairs that are admitted to make crossings. Let us call an admissible set and a crossing pair in an admissible pair. A matching is called at-most--crossings-per-edge (-CPE) if each edge in makes at most crossings along with other edges in and every crossing pair that appears in belongs to .

We formalize the max-weighted -CPE matching problem (MW--CPEMP) as follows.

•    Max-weighted -CPE matching problem (MW--CPEMP) Input: A bipartite graph along with its 2-layered drawing, a positive edge weight function , and an admissible set . Output: A -CPE matching that maximizes .

For example, when , we are asked to compute a max-weighted -CPE matching such that any crossing pair may appear. When or , the problem asks for a max-weighted non-crossing matching since no crossing pair is admitted.

In the present paper, we propose polynomial time algorithms for the MW--CPEMP with . Our approach reduces the MW--CPEMP to what we call the non-contact trapezoid selection problem (NTSP). We then solve the reduced NTSP problem by an algorithm named SelectTrape, which is an extension of the Malucelli et al.’s -time algorithm for the MW-0-CPEMP [10]. The time complexities of the proposed algorithms are for and for respectively, where .

The paper is organized as follows. We describe our motivation and related work in Section 2. In Section 3, we introduce the NTSP and present the algorithm SelectTrape. We then explain how to reduce the MW--CPEMP to the NTSP in Section 4, followed by concluding remarks in Section 5.

## 2 Background

### 2.1 Motivation

Plant chronobiologists would like to compare gene expression dynamics at the individual level (i.e., macro level) with the single cell level (i.e., micro level) along the same time axis. However, there is a technically hard issue. Conventional microarray or RNA-sequencing can easily measure individual gene expression patterns in actual time-series but have limited spatial resolutions. On the other hand, single-cell transcriptome techniques have ultimate spatial resolution of gene expression analysis, but most techniques are requiring destruction of cells to perform single cell transcriptome and thus actual time-series analysis is impossible. Thus, to provide an analytic tool to achieve higher spatiotemporal resolution was required.

As an alternative, single cell analysis often uses pseudo time-series reconstruction for revealing cell-state transition (e.g., [16, 23]). Pseudo time reconstruction is a process that orders cells transcriptome on a hypothetical time axis, along which they show continuous changes in the transcriptome. However, ordinal scale-based pseudo time-series will not provide any time information so that it is impossible to analyze circadian rhythm, for example, in a single cell resolution.

We have hypothesized that timing of significant gene expression peak on the pseudo time-series is comparable to that on the actual time-series. In our recent work [22]

, we formulated the problem of estimating the actual time of cell expressions as the MW-0-CPEMP. We considered a 2-layered drawing of a complete bipartite graph

such that is the set of individual expression records that are sorted in the actual-time order, and is the set of cell expression records that are sorted in a hypothetical order. We weighted each edge

by a heuristic method that evaluates how

and are likely to match. Solving the MW-0-CPEMP on , we estimated the actual time of a gene expression by the time of the individual expression to which is matched. We used the non-crossing constraint because we would like to preserve the vertex orders.

We observed that the model can be a useful tool for actual-time estimation, compared with conventional actual-time estimation methods. In pursuit of alternative models, we study the MW--CPEMP for a constant .

### 2.2 Related Work

The MW-0-CPEMP is an extension of the longest common subsequence problem on given two sequences [5]. It has an application in the sequence alignment problem that appears in bioinformatics [24]

[12].

Knauer et al. [9] studied the problem of finding a subgraph that has few edge crossings; given a graph (not necessarily bipartite) and its geometric drawing (i.e., every vertex is specified by a 2D point, all edges are drawn as straight line segments, and no two edges overlap or intersect at a vertex), we are asked to find a subgraph of a certain class that makes the minimum number of edge crossings. They showed that, for spanning trees, - paths, cycles, matchings of a fixed size, and 1- or 2-factors, it is NP-hard to approximate the minimum number of edge crossings within a factor of for any , where denotes the number of edge crossings in the given graph. They also presented fixed-parameter algorithms to decide whether there is a non-crossing subgraph of one of the above graph classes, where is used as the parameter.

The non-crossing (or crossing-free) constraint has been considered for some problems of finding an “optimal” subgraph. It is Malucelli et al. [10] who first studied the algorithmic aspect of the MW-0-CPEMP explicitly. For the edge-unweighted case, they provided a polynomial-time algorithm that runs in time or in time, where denotes the cardinality of a maximum 0-CPE matching. They also extended the algorithm to the edge-weighted case, which yields an time algorithm. A bipartite graph is convex if, for every , implies for all . For the MW-0-CPEMP in edge-unweighted convex bipartite graphs, Chen et al. [4] presented an algorithm whose running time is . Carlsson et al. [3] considered the Euclidean non-crossing bipartite matching problem, where each vertex is represented by a 2D point. The objective is to find a non-crossing perfect matching whose longest edge is minimized. They showed that the problem is NP-hard in general, but that it is polynomially-solvable in some special cases. More recently, Altinel et al. [1] showed that the minimum cost non-crossing flow problem on a layered network is NP-hard. Ruangwises and Itoh [18] studied the stable marriage problem under the non-crossing constraint, showing that there exists a weakly stable non-crossing matching for any instance.

The conflict pair constraint (or negative disjunctive constraint) is a generalization of the non-crossing constraint. Represented by a conflict graph , this constraint prohibits a solution from including two edges such that . The minimum cost perfect matching problem with conflict pair constraints is strong NP-hard for a general graph even if the conflict graph is a collection of single edges [6] and is NP-hard even for that consists of 4-cycles [13]; it turns out that the problem is NP-hard for a bipartite graph. For this type of constraint, there are also studies on the transportation problem [20, 21], the minimum spanning tree problem [7, 25, 15], and the max-flow problem [14].

## 3 Non-contact Trapezoid Selection Problem

To solve the MW--CPEMP, we reduce the problem to what we call the non-contact trapezoid selection problem (NTSP). In this section, we define the NTSP and propose an efficient algorithm for it. The algorithm is an extension of the Malucelli et al.’s algorithm [10] for the MW-0-CPEMP.

### 3.1 Problem Description

Suppose two distinct horizontal lines on the 2D plane. Let and denote vertex sets. We put on the upper line from left to right, and on the lower line from left to right. We are given a collection of weighted trapezoids such that each is given its weight, denoted by , and its two upper corners are among , whereas its two lower corners are among . We denote by (resp., ) the index (resp., ) of the upper-left corner (resp., upper-right corner ). Similarly, we denote by (resp., ) the index (resp., ) of the lower-left corner (resp., lower-right corner ). We admit to be a triangle or a line segment. Then and hold.

Given , the NTSP asks for a max-weighted subcollection such that any do not contact each other. Specifically, for any with and , it should hold that and .

### 3.2 Partial Order Based Algorithm

We can solve the NTSP by using the notion of partial order. Let us introduce a binary relation on ; For , we write if and . One easily sees that is a (or an irreflexive) partial order on , and thus is a partially ordered set (poset). We say that and are comparable if either or holds. For a subcollection , the poset (or ) is called a chain if every are comparable. Obviously is a feasible solution of the NTSP iff it is a chain.

We represent the poset by a directed acyclic graph (DAG). We denote the DAG by , where is the dummy node and is the arc set such that

 Aϕ ={(ϕ,T′):T′∈T}, A≺ ={(T,T′)∈T×T:T≺T′}.

For an arc , we define the distance to be . Any feasible solution of the NTSP is represented by a path from . Then we can solve the NTSP by solving the longest path problem on . The time complexity of this algorithm is because we can construct and solve the longest path problem in time [5].

### 3.3 An Efficient Algorithm SelectTrape

We propose a faster algorithm whose time complexity is . The proposed algorithm is based on the Malucelli et al.’s algorithm [10] for the MW-0-CPEMP. The MW-0-CPEMP is regarded as a special case of the NTSP such that every trapezoid is a line segment, that is, and . We extend the Malucelli et al.’s algorithm based on this observation.

For two integers with , let us denote and . We define and . Similarly, for integers with , we define a subset and . We say that a trapezoid is contained in if all corners are contained in the vertex subset, that is, and .

For , we denote by the max-weight of a feasible solution that has as the rightmost trapezoid (i.e., no in the solution satisfies ). For , we denote by the max-weight of a feasible solution such that the trapezoids are contained in and the lower-right corner of the rightmost trapezoid is exactly . For convenience, we let for all . The following lemmas are obvious by the definitions.

###### Lemma 1

Suppose that is given. For , we have

 μT(Ts)=ω(Ts)+max{μγ(λA(Ts)−1,q):q∈[λB(Ts)−1]}.
###### Lemma 2

Suppose that is given. For , we have

 μγ(i,q)=max{μγ(i−1,q),maxTs∈T:(γA(Ts),γB(Ts))=(i,q){μT(Ts)}}.

In Algorithm 1, we show an algorithm SelectTrape that computes the optimal weight of a given NTSP instance. The algorithm repeats the outer for-loop for . We do not store for all , but only for the current . It is stored as . When every is a line segment (i.e., and ), the algorithm works exactly in the same way as the Malucelli et al.’s algorithm.

###### Theorem 1

Given an instance of the NTSP, the algorithm SelectTrape in Algorithm 1 computes the optimal weight in time and in space, where .

Proof: We show that holds at the beginning of the outer for-loop with respect to (i.e., line 1). When , we have by line 1. In line 1, we see that is computed correctly for with , due to (by induction) and Lemma 1. The second inner for-loop (i.e., line 1 to 1) computes the maximum among and for all with , and substitutes the maximum for , which is by Lemma 2. Upon completion of the algorithm, we have , which is the optimal value.

We analyze the computational complexity. Each trapezoid is searched as in the first inner for-loop exactly once, and as in the second inner for-loop exactly once. We can access with in line 1 (and with in line 1) in time by executing the bucket sort on beforehand. We use priority search tree [11] to store for , by which we can take the maximum in line 1 in time. We see that the algorithm runs in time. We use space to store for and for .

Using the algorithm, we can construct an optimal solution as follows.

• For , let denote a max-weighted feasible solution such that all trapezoids in are contained in and that the lower-right corner of the rightmost one, say , is (i.e., ). We compute such of for every and maintain it as . The can be obtained as follows. We initialize for all . In line 1, if holds for the current , then we update .

• For , let denote a max-weighted feasible solution such that is the rightmost trapezoid, and denote the trapezoid that is to the immediate left of in . We maintain the index as . To obtain , we first initialize for all and update in line 1, where is a maximizer of .

Let denote a maximizer of . Then is the rightmost trapezoid in the optimal solution. Setting and , while , we repeat , and . The obtained is the optimal solution. The procedure takes extra time.

## 4 Algorithm for the MW-c-Cpemp

In this section, we reduce the MW--CPEMP to the NTSP, which yields polynomial-time algorithms for the cases of and 2. Throughout this section, we assume that an instance of the MW--CPEMP is given for a non-negative constant . We also assume that is expressed by a list of crossing pairs.

Before proceeding, let us mention that the problem is solvable in -time as follows, where and is introduced to ignore polynomial factors; For each , let . In other words, is the set of edges that appear in . We check whether is a -CPE matching, which can be done in polynomial time. If it is the case, we compute a max-weighted non-crossing matching, say , on the subgraph that is obtained by removing and the extreme points from . The can be computed in polynomial time by using the Malucelli et al’s algorithm [10]. The max-weighted -CPE matching over is an optimal solution.

### 4.1 Notations

For , we define to be the smallest index among the vertices in . For convenience, we let be zero when . That is,

 λA(V′)≜{minai∈A∩V′{i}if\ A∩V′≠∅,0otherwise.

Similarly, we define to be the largest index among the vertices in , and for convenience, it is set to if . That is,

 γA(V′)≜{maxaj∈A∩V′{j}if\ A∩V′≠∅,nA+1otherwise.

Observe that, when , and represent the indices of the leftmost and rightmost vertices in , respectively. We define and in the analogous way.

For an edge subset , we define to be the set of extreme points of edges in . For simplicity, We write by . The notations , and are analogous. When is a singleton, that is, for some edge , we write as . In this case, it holds that and . We write an inequality as . Using this notation, and intersect if ( and ) or ( and ).

Recall that denotes the set of all possible crossing pairs in . Observe that each is a matching that consists of two intersecting edges. We may write in

as an ordered pair

when we assume (and thus ). For a matching , we define to be a set of crossing pairs that appear in , that is,

 XG[M]≜{{e,e′}∈XG:e,e′∈M}.

A matching is at-most--crossings-per-edge (-CPE) if holds and each appears in at most crossing pairs in . Hence, is 0-CPE iff .

### 4.2 Overview

Let denote the family of all matchings in . We regard any as a trapezoid that has with as the upper-left corner, with as the upper-right corner, with as the lower-left corner, and with as the lower-right corner, and that has the weight . Then is a poset, where is the partial order on a trapezoid collection that we introduced in Section 3.2.

###### Lemma 3

For a -layered bipartite graph , let . For any , exactly one of the following holds:

(i)

; and

(ii)

and are comparable.

Proof: When , (ii) holds. Suppose that . If and intersect, then we have . Otherwise, either or should hold as they do not share endpoints in common.

We introduce an auxiliary graph, which we denote by . We call an edge in the underlying graph a node when we use it in the context of . For , we denote by the subgraph induced by . Let denote the family of connected components in .

###### Lemma 4

For a -layered bipartite graph , let . Then is a chain.

Proof: We show that any are comparable. The and are node sets of connected components of . For any and , and are not adjacent. Then holds. By Lemma 3, and are comparable. We assume that without loss of generality. Suppose that there is such that . Since is connected, there is a path between and . The path should contain an edge that intersects with in . Then , which contradicts that and are not adjacent in . We see that holds for any and and thus holds.

Let denote the family of all -CPE matchings. For a -CPE matching , it holds that and the degree of any node in is at most . We call connected if is connected. By Lemma 4, any is partitioned into connected -CPE matchings.

If we are given a family of all connected -CPE matchings (which are regarded as trapezoids), then we can find a max-weighted -CPE matching by solving the corresponding NTSP. The time complexity of this algorithm is by Theorem 1, where denotes the time for constructing . Then, if and are polynomially bounded, the total running time of the algorithm is also polynomially bounded.

Let us consider how to construct . For , the degree of any node in is at most . Then, when , we have , that is, the collection of isolated nodes in . Then holds. When , we have , and thus holds. For , the following theorems are immediate.

###### Theorem 2 (Malucelli et al. [10])

Given an instance of the MW--CPEMP, we can find a max-weighted -CPE matching in time and in space.

###### Theorem 3

Given an instance of the MW--CPEMP, we can find a max-weighted -CPE matching in time and in space.

### 4.3 Trapezoid Collection for c=2

For a connected 2-CPE matching , the auxiliary graph is an isolated point, an edge, a cycle or a path, and should hold. The next lemma tells that, when it is a cycle, the length (which is ) is at most four. We call a cycle an -cycle if the length is .

###### Lemma 5

For a -layered bipartite graph and an admissible set , let be a -CPE matching. If is a cycle, then is at most four.

Proof: Each edge in intersects with exactly two other edges in . Hence . Let . Without loss of generality, we suppose that holds for all , that and are two edges that intersect with , and that holds.

As shown in Figure 1 (a), if and intersect, then we see that any of intersects with two others. Since is a cycle, holds. Otherwise (i.e., if and do not intersect), as shown in Figure 1 (b), we have and . Since is a cycle, the edge intersects with another edge in , say . From the definition of , we have . Since and should not intersect, holds. Since and intersect, holds. We see that intersects with and , and intersects with and . Any of intersects with two others, and thus we have .

###### Lemma 6

For a -layered bipartite graph and an admissible set , we can enumerate all - and -cycles in time and in space.

Proof: First, we construct an intersection matrix such that each row/column corresponds to an edge, and that each entry takes 1 (resp., 0) if the corresponding edge pair belongs to (resp., does not belong to ). We can construct in time and store it in space.

We can enumerate all 4-cycles in time as follows; for each , let and , where we assume without loss of generality. We check whether is a matching such that and . If yes, then is a 4-cycle (Figure 1 (b)). The check can be done in time since whether or not can be identified in time by using . Enumeration of 3-cycles is analogous.

There may exist an exponentially large number of paths in . However, for our purpose, it is sufficient to take into account only paths; Let be a 2-CPE matching such that is a path. There are two nodes whose degrees are one. This means that and appear in exactly one admissible pair in . Suppose that holds without loss of generality. We call with (resp., ) the leftmost (resp., rightmost) admissible pair of . For , we call a 2-CPE matching an -path if is a path and and are the leftmost and rightmost admissible pairs of , respectively. Among all -paths, we have only to take a max-weighted one into account because all -paths form the same trapezoid whose corners are , , , and , where , , , and . We define the size of an -path to be , that is, the number of edges in the matching . In Figure 2 (a) and (b), we show a 2-CPE matching that is an -path for and . The size of is eight. We also show the path in the auxiliary graph in Figure 3.

For , we denote by the max-weight of an -path. We also denote by (resp., ) the max-weight of an

-path such that the size is odd (resp., even). We let

, , and be when no corresponding path exists. Clearly we have

 ρ∗(X,Y)=max{ρ∗odd(X,Y),ρ∗even(X,Y)}. (1)

If , then the path size is two and holds. If , then the path size is three and holds. If , then the path size is no less than four.

#### A max-weighted even-sized (X,y)-path.

We study how to obtain a max-weighted even-sized -path for given . We design an algorithm that computes and constructs the path. This strategy is then extended to the odd-size case.

For , let and . We say that an ordered pair is a link if one of the followings holds:

(a)

, , , and .

(b)

,