1 Introduction
Let denote an edgeweighted 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 (maxweighted 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 nonnegative 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 atmostcrossingsperedge (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 maxweighted CPE matching problem (MWCPEMP) as follows.

Maxweighted CPE matching problem (MWCPEMP) Input: A bipartite graph along with its 2layered 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 maxweighted CPE matching such that any crossing pair may appear. When or , the problem asks for a maxweighted noncrossing matching since no crossing pair is admitted.
In the present paper, we propose polynomial time algorithms for the MWCPEMP with . Our approach reduces the MWCPEMP to what we call the noncontact 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 MW0CPEMP [10]. The time complexities of the proposed algorithms are for and for respectively, where .
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 RNAsequencing can easily measure individual gene expression patterns in actual timeseries but have limited spatial resolutions. On the other hand, singlecell 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 timeseries 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 timeseries reconstruction for revealing cellstate 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 scalebased pseudo timeseries 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 timeseries is comparable to that on the actual timeseries. In our recent work [22]
, we formulated the problem of estimating the actual time of cell expressions as the MW0CPEMP. We considered a 2layered drawing of a complete bipartite graph
such that is the set of individual expression records that are sorted in the actualtime order, and is the set of cell expression records that are sorted in a hypothetical order. We weighted each edgeby a heuristic method that evaluates how
and are likely to match. Solving the MW0CPEMP on , we estimated the actual time of a gene expression by the time of the individual expression to which is matched. We used the noncrossing constraint because we would like to preserve the vertex orders.We observed that the model can be a useful tool for actualtime estimation, compared with conventional actualtime estimation methods. In pursuit of alternative models, we study the MWCPEMP for a constant .
2.2 Related Work
The MW0CPEMP 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]
and in natural language processing
[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 2factors, it is NPhard 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 fixedparameter algorithms to decide whether there is a noncrossing subgraph of one of the above graph classes, where is used as the parameter.
The noncrossing (or crossingfree) 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 MW0CPEMP explicitly. For the edgeunweighted case, they provided a polynomialtime algorithm that runs in time or in time, where denotes the cardinality of a maximum 0CPE matching. They also extended the algorithm to the edgeweighted case, which yields an time algorithm. A bipartite graph is convex if, for every , implies for all . For the MW0CPEMP in edgeunweighted convex bipartite graphs, Chen et al. [4] presented an algorithm whose running time is . Carlsson et al. [3] considered the Euclidean noncrossing bipartite matching problem, where each vertex is represented by a 2D point. The objective is to find a noncrossing perfect matching whose longest edge is minimized. They showed that the problem is NPhard in general, but that it is polynomiallysolvable in some special cases. More recently, Altinel et al. [1] showed that the minimum cost noncrossing flow problem on a layered network is NPhard. Ruangwises and Itoh [18] studied the stable marriage problem under the noncrossing constraint, showing that there exists a weakly stable noncrossing matching for any instance.
The conflict pair constraint (or negative disjunctive constraint) is a generalization of the noncrossing 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 NPhard for a general graph even if the conflict graph is a collection of single edges [6] and is NPhard even for that consists of 4cycles [13]; it turns out that the problem is NPhard 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 maxflow problem [14].
3 Noncontact Trapezoid Selection Problem
To solve the MWCPEMP, we reduce the problem to what we call the noncontact 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 MW0CPEMP.
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 upperleft corner (resp., upperright corner ). Similarly, we denote by (resp., ) the index (resp., ) of the lowerleft corner (resp., lowerright corner ). We admit to be a triangle or a line segment. Then and hold.
Given , the NTSP asks for a maxweighted 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
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 MW0CPEMP. The MW0CPEMP 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 maxweight of a feasible solution that has as the rightmost trapezoid (i.e., no in the solution satisfies ). For , we denote by the maxweight of a feasible solution such that the trapezoids are contained in and the lowerright 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
Lemma 2
Suppose that is given. For , we have
In Algorithm 1, we show an algorithm SelectTrape that computes the optimal weight of a given NTSP instance. The algorithm repeats the outer forloop 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 forloop 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 forloop (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 forloop exactly once, and as in the second inner forloop 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 maxweighted feasible solution such that all trapezoids in are contained in and that the lowerright 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 maxweighted 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 MWCpemp
In this section, we reduce the MWCPEMP to the NTSP, which yields polynomialtime algorithms for the cases of and 2. Throughout this section, we assume that an instance of the MWCPEMP is given for a nonnegative 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 maxweighted noncrossing 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 maxweighted 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,
Similarly, we define to be the largest index among the vertices in , and for convenience, it is set to if . That is,
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,A matching is atmostcrossingsperedge (CPE) if holds and each appears in at most crossing pairs in . Hence, is 0CPE iff .
4.2 Overview
Let denote the family of all matchings in . We regard any as a trapezoid that has with as the upperleft corner, with as the upperright corner, with as the lowerleft corner, and with as the lowerright 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 maxweighted 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 MWCPEMP, we can find a maxweighted CPE matching in time and in space.
Theorem 3
Given an instance of the MWCPEMP, we can find a maxweighted CPE matching in time and in space.
4.3 Trapezoid Collection for
For a connected 2CPE 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 .
(a) 3cycle  (b) 4cycle 
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 4cycles 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 4cycle (Figure 1 (b)). The check can be done in time since whether or not can be identified in time by using . Enumeration of 3cycles 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 2CPE 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 2CPE 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 maxweighted 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 2CPE matching that is an path for and . The size of is eight. We also show the path in the auxiliary graph in Figure 3.
(a) Upper path  (b) Lower path 
For , we denote by the maxweight of an path. We also denote by (resp., ) the maxweight of an
path such that the size is odd (resp., even). We let
, , and be when no corresponding path exists. Clearly we have(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 maxweighted evensized path.
We study how to obtain a maxweighted evensized path for given . We design an algorithm that computes and constructs the path. This strategy is then extended to the oddsize case.
For , let and . We say that an ordered pair is a link if one of the followings holds:
 (a)

, , , and .
 (b)

,
Comments
There are no comments yet.