Abstract 1 Introduction 2 Preliminaries 3 Problem Complexity 4 An Exact Reduction Rule 5 Exact Integer Linear Programming Approaches 6 Experimental Analysis 7 Conclusion and Future Work References Appendix A Complexity Results for the Turn-Minimization Problem

Visualization of Event Graphs for Train Schedules

Johann Hartleb ORCID DB InfraGO AG, Berlin, Germany Marie Schmidt ORCID Universität Würzburg, Germany Samuel Wolf ORCID Universität Würzburg, Germany Alexander Wolff ORCID Universität Würzburg, Germany
Abstract

Train timetables can be represented as event graphs, where events correspond to a train passing through a location at a certain point in time. A visual representation of an event graph is important for many applications such as dispatching and (the development of) dispatching software. A common way to represent event graphs are time-space diagrams. In such a diagram, key locations are visualized on the y-axis and time on the x-axis of a coordinate system. A train’s movement is then represented as a connected sequence of line segments in this coordinate system. This visualization allows for an easy detection of infrastructure conflicts and safety distance violations. However, time-space diagrams are usually used only to depict event graphs that are restricted to corridors, where an obvious ordering of the locations exists.

In this paper, we consider the visualization of general event graphs in time-space diagrams, where the challenge is to find an ordering of the locations that produces readable drawings. We argue that this means to minimize the number of turns, i.e., the total number of changes in y-direction. To this end, we establish a connection between this problem and Maximum Betweenness. Then we develop a preprocessing strategy to reduce the instance size. We also propose a parameterized algorithm and integer linear programming formulations. We experimentally evaluate the preprocessing strategy and the integer programming formulations on a real-world dataset. Our best algorithm solves every instance in the dataset in less than a second. This suggests that turn-optimal time-space diagrams can be computed in real time.

Keywords and phrases:
Graph Drawing, Event Graphs, Integer Linear Programming, Parameterized Algorithms, Treewidth
Copyright and License:
[Uncaptioned image] © Johann Hartleb, Marie Schmidt, Samuel Wolf, and Alexander Wolff; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Graph algorithms analysis
; Theory of computation Fixed parameter tractability ; Theory of computation Computational geometry
Editors:
Jonas Sauer and Marie Schmidt

1 Introduction

Train schedules are subject to constant changes due to interferences such as temporary infrastructure malfunctions or congestion resulting from high traffic volume. As a consequence, train schedules must be adjusted in real-time to remedy the disturbances via rerouting and other means. In recent years, the computer-assisted execution of this process has gained track. DB InfraGO AG, a subsidiary of Deutsche Bahn AG, is developing approaches based on so-called event graphs [8] as an underlying structure that encodes the necessary information to (re-)compute a train schedule. An event graph models trains running on specific routes on an infrastructure via events.

Definition 1 (Event Graph).

An event graph is a directed graph. Let V() denote the vertex set of . Each vertex v of , called event, is associated with a location (v), a positive integer train(v), and a point of time t(v) when the event is scheduled. For two different events u and w, if t(u)=t(w), then train(u)train(w) and (u)(w). There is an arc (u,w) in if (i) train(u)=train(w), (ii) t(u)<t(w), and (iii) there is no event v with train(v)=train(u) and t(u)<t(v)<t(w).

For a train z, we call the sequence v1,,vj of all events with train(v1)==train(vj)=z ordered by t() the train line of train z.

For the further automation and for real-time human intervention with timetables, it is important that large event graphs can be easily understood by humans.

If the event graph corresponds to trains running on a corridor, i.e., trains running from point a to point b in a linear piece of infrastructure, time-space diagrams are a common way to represent the event graph. A time-space diagram can be described as a straight-line drawing of the event graph with the additional constraint that all vertices that belong to the same location lie on the same horizontal line and that the x-coordinate of each vertex is given by its point in time.

In this paper, we investigate the possibility to use time-space diagrams for visualizations for general event graphs, i.e., event graphs that are generally not based on a linear piece of infrastructure. We are not aware of any previous work on the visualization of general event graphs. Formally, a time-space diagram can be defined as follows.

Definition 2 (Time-Space Diagram).

Let be an event graph, let Y=|(V())|, and let y:(V()){1,2,,Y} be a bijection. The time-space diagram induced by y is the straight-line drawing of in the plane where event v is mapped to the point (t(v),y((v))).

In a time-space diagram (see Figure 1a for two examples), we call y(p) the level of location p. We also refer to a time-space diagram of an event graph as a drawing of the event graph.

Figure 1: (a) Two different time-space diagrams of the same event graph with locations {1,,6}. (b) The location graph of ; the colored paths are the train lines, the gray numbers are the weights.

If an event graph is based on a corridor, the corridor induces a natural order of the locations: consecutive locations are assigned consecutive levels. In this way, train lines in the time-space diagram correspond to polylines that go only up- or downwards. However, on general event graphs where the trains do not run on a linear piece of infrastructure, this intuitive assignment is far from trivial, and it is not immediately clear which criteria yield a comprehensible drawing. Figure 2 shows two possible time-space diagrams for the same event graph, one that minimizes the number of crossings of line segments (a classical objective in graph drawing) and one that minimizes the number of turns which we define as follows.

Figure 2: Two time-space diagrams of the same event graph. Left: A crossing-minimal drawing with zero crossings (and 71 turns). Right: A turn-minimal drawing with one turn (and five crossings).

Given a drawing Γ of an event graph and three consecutive events of a train line in with pairwise distinct locations p, q, r, we say that there is a turn in Γ if the level of q is smaller/larger than the levels of p and r.111Note that this definition does not consider the case where consecutive events have the same location. It is easy to see, however, that we can normalize any event graph such that consecutive events always have different locations without changing the number of turns in an optimal solution.

Figure 2 and further experiments suggest that minimizing the number of turns leads to time-space diagrams that are significantly better to interpret than drawings that minimize the number of crossings. Therefore, we consider the following problem in this paper.

Problem 3 (Turn Minimization).

Given an event graph , find a time-space diagram of that minimizes the total number of turns along the train lines defined by .

A connection to Maximum Betweenness.

Note that the number of turns in a time-space diagram is determined solely by the function y which represents an ordering of the locations. Therefore, Turn Minimization is closely related to the following problem.

Problem 4 (Maximum Betweenness [16]).

Let S be a finite set, and let RS×S×S be a finite set of ordered triplets called restrictions. A total order satisfies a restriction (a,b,c)R if either abc or cba holds. Find a total order that maximizes the number of satisfied restrictions.

In fact, there is a straightforward translation that transforms optimal solutions of Turn Minimization to optimal solutions of Maximum Betweenness and vice versa. However, note that the objective functions of these problems differ. In Turn Minimization we minimize the number of turns, which corresponds to minimizing the number of unsatisfied restrictions in Maximum Betweenness.

Maximum Betweenness and other slightly modified variants have been studied extensively [17, 18, 7, 19, 6, 5] mainly motivated by applications in biology. In particular, Opatrny showed that Maximum Betweenness is 𝖭𝖯-hard [16]. Further, the problem admits 1/2-approximation algorithms [4, 13], but for any ε>0 it is 𝖭𝖯-hard to compute a (1/2+ε)-approximation [1].

Several exact algorithms have been proposed. There is an intuitive integer linear program formulation that uses linear orderings. This formulation has been used in various variants and algorithms as a baseline before [6, 5]. We state this formulation in Section 5 since we also use this formulation as a starting point. Note that this formulation requires 𝒪(|S|3) many constraints due the transitivity constraints for the linear ordering and the fact that there can be 𝒪(|S|3) many restrictions. This may result in long computation times. Since applications in biology often deal with a large number of restrictions, improvements of this formulation have been made via cutting-plane approaches that target the transitivity and the restriction constraints using the trivial lifting technique222Here: complete linear descriptions of smaller instances (S,R) are used to generate valid inequalities for larger instances (S,R) where SS, RR. [6, 5]. To overcome the issue of a cubic number of transitivity constraints, a mixed-integer linear program has been proposed [19] that circumvents the large number of constraints entirely by modelling a linear ordering with continuous variables that are required to be distinct. As a consequence, this formulation runs faster than the intuitive formulation. However, this program requires a user-specified parameter that influences the runtime significantly and is not obvious to choose.

Note that due to the relationship between Turn Minimization and Maximum Betweenness, exact algorithmic approaches for one of the problems can be directly transferred to the other, while approximation guarantees cannot. However, most of the algorithmic approaches for Maximum Betweenness are optimized for instances where the ratio between |R| and |S| is large, while this ratio is only moderate in our setting. As a result, in our setting, the transitivity constraints become the bottleneck as opposed to the constraints that model the restrictions in R. Another notable difference is that in Turn Minimization we have access to additional information on the relations between restrictions (the train lines). We strive to leverage these differences to develop new approaches. In particular, we consider the case that instances admit drawings with a small number of turns (as otherwise a drawing would not be comprehensible). Further, we consider the case that the underlying infrastructure of the event graph is sparse (as this is common in train infrastructure).

Contribution.

First, we consider Turn Minimization from a (parameterized) complexity theoretic perspective; see Section 3. In particular, we show that it is 𝖭𝖯-hard to compute an α-approximation for any constant α1 and that the problem is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard when parameterized by the number of turns. The problem is also 𝗉𝖺𝗋𝖺-𝖭𝖯-hard when parameterized by the vertex cover number of the location graph, a graph that represents the infrastructure. Second, we propose a preprocessing strategy that reduces a given event graph into a smaller event graph that admits drawings with the same number of turns; see Section 4. Third, we refine the intuitive integer linear program in two different ways; see Section 5. The first refinement is a simple cutting-plane approach that iteratively adds transitivity constraints until a valid (optimal) solution is found. The second refinement uses a tree decomposition to find a light-weight formulation of the problem. We conclude with an experimental analysis and future work in Sections 6 and 7. While the preprocessing strategy cannot be easily translated to the Maximum Betweenness problem, our remaining results carry over.

2 Preliminaries

Let S be a finite set, and k be a positive integer. Let [S]k denote the set {X:XS,|X|=k} of k-element subsets of S. We call (A,B) with AB=V(G) a separation of a graph G if, on every ab path with aA and bB, there is at least one vertex in AB. We call AB a separator. If a separator is a single vertex, we call this vertex a cut vertex. If a separator consists of two vertices, then we call the two vertices a separating pair. We say that a connected graph is biconnected if it does not contain a cut vertex. Similarly, we say that a biconnected graph is triconnected if it does not contain a separating pair. A partition of (A,B) of the vertex set of a graph is a cut. The cut set of (A,B) is the set of edges with one vertex in A and one vertex in B. The size of a cut is the size of the cut set.

Problems that can be solved in time f(k)nc, where f is a computable function, c>0 is a constant, n the input size, and k is a parameter, are known as fixed-parameter tractable (parameterized by the parameter k). The complexity class FPT contains precisely all such fixed parameter tractable problems with the respective parameter k. If a problem remains 𝖭𝖯-hard even on instances, where the parameter k is bounded, we say that the problem is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard when parameterized by k. The study of 𝖥𝖯𝖳 algorithms is particularly motivated by scenarios where certain instances have properties, described by the parameter, that are small or constant, making 𝖥𝖯𝖳 algorithms efficient for these instances.

We define two auxiliary graphs that capture the connections between locations in , which we use in our algorithms.

Definition 5 (Location Graph).

Let be an event graph. The location graph of is an undirected weighted graph whose vertices are the locations of . For two locations pq, the weight w({p,q}) of the edge {p,q} in corresponds to the number of arcs (u,v) or (v,u) in the event graph such that (u)=p and (v)=q and train(u)=train(v). If w({p,q})=0, then p and q are not adjacent in .

See Figure 1b for an example of a location graph. Note that the train line of a train z in the event graph corresponds to a walk (a not necessarily simple path) in the location graph. Slightly abusing notation, we also call this walk in the location graph a train line of z.

Definition 6 (Augmented Location Graph).

Let be an event graph. The augmented location graph of is the supergraph of the location graph of that additionally contains, for each triplet (v,v,v′′) of locations that are consecutive along a train line in , the edge {(v),(v′′)}.

The augmented graph has the crucial property that every three such consecutive events, whose locations can potentially cause a turn, induce a triangle in .

Tree decompositions.

Intuitively, a tree decomposition is a decomposition of a graph G into a tree T which gives structural information about the separability of G. The treewidth of a graph G is a measure that captures how similar a graph G is to a tree. For instance, every tree has treewidth 1, the graph of a (k×k)-grid has treewidth k, and the treewidth of the complete graph Kn is n1. More formally, a tree decomposition 𝒯=(T,{Xt}tV(T)) of G consists of a tree T and, for each node t of T, of a subset Xt of V(G) called bag such that (see Figure 3 for an example):

  1. (T1)

    the union of all bags is V(G),

  2. (T2)

    for every edge {u,v} of G, the tree T contains a node t such that {u,v}Xt, and

  3. (T3)

    for every vertex v of G, the nodes whose bags contain v induce a connected subgraph of T.

Figure 3: Example of a tree decomposition (right) of the graph on the left. Each bag of the tree decomposition is depicted as the graph it induces.

The width of a tree decomposition is defined as max{|Xt|:tV(T)}1; for example, the tree decomposition in Figure 3 has width 2. The treewidth of a graph G, tw(G), is the smallest value such that G admits a tree decomposition of this width. Any tree decomposition (T,{Xt}tV(T)) has the following properties.

  1. (P1)

    For every edge {a,b} of T, the graph T{a,b} has two connected components Ta and Tb, where Ta contains a and Tb contains b. They induce a separation (A,B)=(tV(Ta)Xt,tV(Tb)Xt) of G with separator XaXb. In particular, AB=XaXb, and G does not contain any edge between a vertex in AXa and a vertex in BXb.

  2. (P2)

    For every clique K of G, the tree T contains a node t such that V(K)Xt.

3 Problem Complexity

We study the approximability of Turn Minimization and consider the tractability of Turn Minimization with respect to parameters that we expect to be small in our instances. We obtain negative results for the approximability and for most of the considered parameters, but we propose an 𝖥𝖯𝖳 algorithm parameterized by the treewidth of the augmented location graph.

While 𝖭𝖯-hardness of Turn Minimization is easy to see due to the one-to-one correspondence (of problem instances and optimal solutions) to Maximum Betweenness, approximability results for Maximum Betweenness do not carry over because of the different objectives. In fact, by close inspection of the natural transformation between instances of the two problems (that we give in the proof of Theorem 7), we are able to deduce that there is neither a multiplicative nor an additive constant factor approximation algorithm for Turn Minimization, unless 𝖯=𝖭𝖯. Furthermore, we can derive from the reduction that, unless 𝖯=𝖭𝖯, there is no efficient algorithm even for instances where the number of turns is bounded. By a reduction from the decision version of MaxCut, we can also show that the problem is 𝖭𝖯-hard when parametrized by the vertex cover number. MaxCut asks whether there is a cut of size at least k in a given graph.

Theorem 7 ().

Turn Minimization

  1. (i)

    is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard with respect to the natural parameter, the number of turns,

  2. (ii)

    is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard with respect to the vertex cover number of the location graph,

  3. (iii)

    does not admit polynomial-time multiplicative or additive approximation algorithms unless 𝖯=𝖭𝖯.

Note that (ii) also implies that Turn Minimization is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard if parameterized by the treewidth of the location graph since the treewidth of a graph is bounded by the vertex cover number of the graph. Therefore, there is no fixed-parameter tractable algorithm with respect to the treewidth of , unless 𝖯=𝖭𝖯. However, we obtain the following result.

Theorem 8 ().

Let be an event graph, and let be its augmented location graph. Computing a turn-optimal time-space diagram of is fixed-parameter tractable with respect to the treewidth of .

Proof sketch..

For every triplet of consecutive events, the corresponding locations form a triangle in . Hence, due to Property (P2), in any tree decomposition of , there is a bag that contains the three locations. Thus, every potential turn occurs in at least one bag, and it suffices to run a standard dynamic program over a (nice) tree decomposition of .

Note that this result might not be practical since the treewidth of the augmented location graph might be considerably larger than the treewidth of the location graph.

4 An Exact Reduction Rule

In this section we describe how to reduce the event graph based on the identification and contraction of simple substructures in the location graph. Consider the location graph of an event graph . We call a vertex p of a terminal if a train starts or ends at p. We say that a path in is a chain if each of its vertices has degree exactly 2 in and the path cannot be extended without violating this property. If a chain contains no terminals, and no train line restricted to this chain induces a cycle, then there is always a turn-minimal drawing of that contains no turn along the chain. This is due to the fact that any turn on the chain can be moved to a non-chain vertex adjacent to one of the chain endpoints. We now generalize this intuition, assuming that is not triconnected.

Let {s,t} be a separating pair of , let C be a connected component of {s,t}, and let C=[V(C){s,t}]. We call C a transit component if (i) C does not contain any terminal, and (ii) the trains passing through C via s also pass through t (before possibly passing through s again). A transit component C is contractible if, for each path associated to a train line in C, we can assign a direction such that the resulting directed graph is acyclic.

Reduction Rule 1 (Transit Component Contraction).

Let be an event graph, and let be the location graph of . If is not triconnected, then let {s,t} be a separating pair of and let C be a contractible transit component of {s,t}. For each train z that traverses C, replace in the part of the train line of z between the events that correspond to s and t by the arc (directed according to time) that connects the two events.

Theorem 9.

Let be an event graph. If is an event graph that results from applying Reduction Rule 1 to , then a turn-optimal drawing of and a turn-optimal drawing of have the same number of turns.

Proof.

Let k be the number of turns in a turn-optimal drawing Γ of an event graph and let k be the number of turns in a turn-optimal drawing Γ of an event graph after Reduction Rule 1 was applied on the contractible transit component C. Further, for the sake of simplicity, assume that any train traversing C traverses C only once. If a train z traverses C multiple times, the same arguments apply for each connected component of the train line of z going through C. Note that this can indeed happen (if the event graph represents a schedule that contains a train that moves through C periodically).

Without increasing the number of turns, we now transform Γ into a drawing of that contains C, as follows. Let {s,t} be the pair that separates C from C. Let y(s) and y(t) be the levels of s and t in Γ, respectively. Without loss of generality, assume that y(s)<y(t). Since C is contractible, C admits an acyclic (topological) ordering of the locations in C such that the train line of every train traversing C is directed from s to t. Let C be such an ordering and let z be a train traversing C, where z=v1,,vj is the component of the train line of z that traverses C such that (v1)=s and (vj)=t. Since C is a valid acyclic topological ordering, it holds that (vi)C(vi+1) for each 1i<j. Thus, by extending y so that each vertex p in C is assigned a level y(p)]y(s),y(t)[, with p,qV(C) and y(p)<y(q) if and only if pCq, no additional turns are introduced in the transformed drawing. As a result, we obtain a drawing of that contains C and has the same number of turns as Γ. Hence kk.

Conversely, we transform Γ into a drawing with at most k turns where the component C is contracted. Let {s,t} be the pair that separates C from C. Let y(s) and y(t) be the levels of s and t in Γ. Without loss of generality, y(s)<y(t). First, assume that for each pV(C) it holds that y(s)<y(p)<y(t). Then, contracting C into a single edge transforms Γ into a drawing of the reduced instance with at most k turns. Now, let LV(C) be the set of vertices below s, and let UV(C) be the set of vertices above t. We describe only how to handle U since L can be handled analogously. Let Δ be the number of train lines with at least one vertex in U. We reorder the levels of the vertices in U according to a topological ordering of C restricted to U and move all vertices in U such that their levels are between y(t) and Y=max{y(p):y(p)<y(t),pV(C)}. Each train line with at least one vertex in U corresponds to at least one turn in U, namely a turn at the vertex of a train line with the largest level. Therefore, moving and reordering U removes at least Δ turns. Also, the movement and reordering of U results in at most Δ turns more at t since the only vertices that were moved are vertices in U. After moving and reordering U and L, we are in the first case and can hence contract C. Summing up, we can transform a turn-optimal drawing Γ of an event graph into a drawing with a contracted component C without changing the number of turns, implying that kk.

We conclude that Reduction Rule 1 is sound.

Note that we can apply Reduction Rule 1 exhaustively in cubic time (in the number of vertices and edges of and ): we iterate over all (up to 𝒪(|V()|2) many) separating pairs and contract each connected component with respect to the current pair, if possible. Below we show that, using two data structures, we can speed up the application of Reduction Rule 1 considerably.

Block-cut trees.

A block-cut tree represents a decomposition of a graph into maximal biconnected components (called blocks) and cut vertices. Given a graph G, let 𝒞 be the set of cut vertices of G, and let be the set of blocks of G. Note that two blocks share at most one vertex with each other, namely a cut vertex. The block-cut tree 𝒯bc of G (see Figure 4 for an example) has a node for each element of 𝒞 and an edge between b and c𝒞 if and only if c is contained in the component represented by b. Note that the leaves of a block-cut tree are -nodes. For example, the block-cut tree of a biconnected graph is a single node. The block-cut tree of an n-vertex path is itself a path, with 2n3 nodes.

Figure 4: The block-cut tree (right) of the graph (left). The cut vertices are colored and are represented as circles in the block-cut tree. The maximal biconnected components are represented as rectangles.

SPQR-trees.

If a graph G is biconnected, an SPQR-tree represents the decomposition of G into its triconnected components via separating pairs, where S (series), P (parallel), Q (a single edge), and R (remaining or rigid) stand for the different node types of the tree that represent how the triconnected components compose G. An SPQR-tree represents all planar embeddings of a graph. Therefore, SPQR-trees are widely used in graph drawing and beyond [15]. SPQR-trees are defined in several ways in the literature. Here, we recall the definition of Gutwenger and Mutzel [10], which is based on an earlier definition of Di Battista and Tamassia [2].

Let G be a multi-graph. A split pair is either a separating pair or a pair of adjacent vertices. A split component of a split pair {u,v} is either an edge {u,v} or a maximal subgraph C (containing {u,v}) of G such that {u,v} is not a split pair of C. Let {s,t} be a split pair of G. A maximal split pair {u,v} of G with respect to {s,t} is a pair such that, for any other split pair {u,v}, the vertices u, v, s, and t are in the same split component. Let e={s,t} be an edge of G called reference edge. The SPQR-tree 𝒯spqr of G with respect to e is a rooted tree whose nodes are of four types: S, P, Q, and R. Each node μ of 𝒯spqr has an associated biconnected multi-graph called the skeleton of μ. Every vertex in a skeleton corresponds to a vertex in G and every edge {u,v} in a skeleton corresponds to a child of μ that represents a split component of G that is separated by {u,v}. The tree 𝒯spqr is recursively defined as follows (see Figure 5 for an example):

Figure 5: The SPQR-tree (right) of the graph on the left, with respect to the edge e. The nodes of the tree are the rectangles. Each rectangle contains the skeleton of the corresponding node. The dashed edge in the representation of a node μ is the virtual edge of the parent of μ. The thick purple edges in the skeletons represent child components. The solid black edges are the real edges of the graph. Q-nodes are omitted for simplicity. In each rectangle, the two green vertices are the poles of the corresponding skeleton. The grey P-node is the unique child of the root (a Q-node) which represents the reference edge e.
Trivial Case:

If G consists of exactly two parallel edges between s and t, then 𝒯spqr consists of a single Q-node whose skeleton is G itself.

Parallel Case:

If the split pair {s,t} has at least three split components G1,,Gk, the root of 𝒯spqr is a P-node μ whose skeleton consists of k parallel edges e1,,ek between s and t.

Series Case:

If the split pair {s,t} has exactly two split components, one of them is e, and the other is denoted with G. If G has cut vertices c1,,ck1 (k2) that partition G into its blocks G1,,Gk, in this order from s to t, the root of 𝒯spqr is an S-node μ whose skeleton is the cycle e0,e1,,ek, where e0=e, c0=s, ck=t, and ei=(ci1,ci) for i=1,,k.

Rigid Case:

If none of the above cases applies, let {s1,t1},,{sk,tk} be the maximal split pairs of G with respect to {s,t} and let Gi (i=1,,k) be the union of all the split components of {si,ti} but the one containing e. The root of 𝒯spqr is an R-node whose skeleton is obtained from G by replacing each subgraph Gi with the edge ei={si,ti}.

Except for the trivial case, every node μ of 𝒯spqr has children μ1,,μk such that μi is the root of the SPQR-tree of Giei with respect to ei. The reference edge e is represented by a Q-node which is the root of 𝒯spqr. Each edge ei in the skeleton of μ is associated with the child μi of μ. This edge is also present in μi and is called virtual edge in μi. The endpoints of edge ei are called poles of the node μi. The pertinent graph Gμ of μ is the subgraph of G that corresponds to the real edges (Q-nodes) in the subtree rooted at μ.

Theorem 10.

If is the location graph of an event graph , then Reduction Rule 1 can be applied exhaustively in time linear in the number of vertices and edges of and .

Proof.

Let be the connected location graph of an event graph . If the location graph is not connected we can apply the algorithm on every connected component of . We consider the case where is not biconnected as this case also handles the biconnected subgraphs of and can therefore easily be adapted for the case where is biconnected. We start by decomposing into a block-cut tree 𝒯bc with vertex set 𝒞. For every block b in we do the following. We construct an SPQR-tree 𝒯spqrb of the biconnected component corresponding to the block b and temporarily mark all cut vertices of 𝒞 contained in b as terminal in b so that no cut vertex can be contracted while we process 𝒯spqrb. Let μr be the root of 𝒯spqrb and let μ be the event graph that corresponds to the pertinent graph μ for a node μ in 𝒯spqrb. We say a train loops at vertex s for some split pair {s,t}, if there is a train whose train line contains the subsequence t,s,t. Intuitively, we traverse 𝒯spqrb bottom-up, and mark nodes in 𝒯spqrb (and the corresponding edge in their parent) as contractible or non-contractible and modify μ using Reduction Rule 1. Due to the correspondence between vertices in a skeleton and vertices in we use “vertex in a skeleton” and “vertex in ” interchangeably. We do the following depending on the type of μμr.

Q-node:

We mark the edge corresponding to μ in the skeleton of the parent of μ as contractible (a contraction of the real edge corresponding to μ does not result in a different graph). If there is a train that loops at one of the poles of μ, we mark this pole as terminal.

S-node:

Let c1,,ck1 be the path that corresponds to the skeleton of μ without the virtual edge of its parent. Every maximal subpath of contractible edges that does not contain any terminal ci is therefore a contractible transit component. Thus, we can apply Reduction Rule 1 on the graph that is induced by this subpath. If the entire path c1,,ck1 is contractible, then we mark the edge corresponding to μ in the skeleton of μ’s parent as contractible, otherwise we mark it as non-contractible. In the contractible case, we check if there is a train that loops at the poles of μ. If this is the case, we mark the corresponding pole(s) as terminal.

P-node:

Let e1,,ek be the edges between the poles of μ without the virtual edge corresponding to the parent of μ. We consider every contractible edge among e1,,ek as a single transit component C and apply Reduction Rule 1. Note that C is a contractible transit component since the union of parallel contractible transit components is again a contractible transit component. If every edge e1,,ek is contractible, we mark the edge corresponding to μ in the skeleton of μ’s parent as contractible. Further, we check if there is a train that loops at the poles of μ. If this is the case, we mark the corresponding pole(s) as terminal.

R-node:

Let C be the skeleton of μ without the virtual edge of its parent. If every edge in C is contractible, then we test if C is a contractible transit component with respect to the poles of μ. If this is the case, we apply Reduction Rule 1 on C and mark the edge corresponding to μ in the skeleton of μ’s parent as contractible. Again, if there is a train that loops at one of the poles of μ, we mark the corresponding pole(s) as terminal.

To process the root μr of 𝒯spqrb, we do the following depending on the type of the single child μc of μr. If μc is an S-node, we check if the edge corresponding to μc is marked as contractible. If this is the case, we mark b as contractible. Otherwise, we consider the maximal subpath of the skeleton of μc that now contains the edge corresponding to μr and apply Reduction Rule 1, if possible. If μc is a P- or R-node, we mark b as contractible if μc is also contractible. To complete the processing of b, we finally check whether there is a train that loops at one of the poles of μr, if this is the case we mark b as non-contractible. Additionally, if this pole is also a cut vertex, we mark it as terminal. It remains to test for one special case. If for every skeleton in 𝒯spqrb every edge is marked as contractible, except for a single edge e in an R-node, test if Ce is a contractible transit component where Ce is the split component of e. If this is the case apply Reduction Rule 1.

After we have completed every block b in , we mark every node c in 𝒞 as contractible if c is not a terminal. Finally, we proceed similarly to the S-node previously. For every chain in 𝒯bc that contains only contractible vertices, we apply Reduction Rule 1.

A block-cut tree and an SPQR-tree can be computed in linear time each [12, 10]. It is easy to see that the total size of all skeletons is linear in the size of the location graph. Since each node is processed in time linear in the size of its skeleton and of the corresponding event graph, the entire algorithm takes time linear in the sizes of and .

5 Exact Integer Linear Programming Approaches

To state an ILP for Turn Minimization, we transform a given event graph and its location graph into an equivalent Maximum Betweenness instance (S,R), where S=V() and R contains all triplets of locations of consecutive events in all train lines of . However, we state the ILP in the context of Turn Minimization and minimize the number of violated constraints. We start with the intuitive integer linear program.

We assume that the set of restrictions R is ordered arbitrarily, and we denote the i-th element in R by (p,q,r)i. Further, let U={(p,q,r):{p,r}[S]2,qS,qp,qr}. For each pair of elements p,qS with pq, let xpq{0,1} be a binary decision variable, where xpq=1 means that pq. We require xpq=1xqp to ensure asymmetry. Further, we model the transitivity constraints of an ordering for (p,q,r)U using the constraint

xprxpq+xqr1,

i.e., the constraint ensures that if pq and qr, then pr must hold as well.

It remains to count the number of restrictions (p,q,r)iR that are violated. For this purpose, we introduce a binary variable bi for each restriction (p,q,r)iR. The intended meaning of bi=1 is that restriction i is violated. Note that a restriction (p,q,r)i is similar to a transitivity constraint. If qp and qr, or pq and rq, then bi=1. Thus, for each restriction (p,q,r)i the following two constraints force bi=1 if the restriction is violated.

bi xqp+xqr1
bi xpq+xrq1.

Thus, we obtain the following formulation (𝖨𝖫𝖯1):

minimize(p,q,r)iRbi (1a)
subjectto xpq =1xqp {p,q}[S]2, (1b)
xpr xpq+xqr1 (p,q,r)U, (1c)
bi xqp+xqr1 (p,q,r)iR, (1d)
bi xpq+xrq1 (p,q,r)iR, (1e)
xpq {0,1} (p,q)S2,pq, (1f)
bi {0,1} (p,q,r)iR (1g)

Cutting plane approach.

As a first improvement over 𝖨𝖫𝖯1, we test a cutting plane approach. We start by solving a relaxation of 𝖨𝖫𝖯1 that omits only the transitivity constraints (1c). To solve the separation problem, i.e., to find violated constraints (1c), we search for up to k cycles in the auxiliary graph G that contains a vertex for each location and has a directed edge (p,q) if and only if xpq=1. A cycle in G then corresponds to a violated transitivity constraint. Note that for each pair of vertices pq in G, there is either an edge (p,q) or an edge (q,p), due to constraints (1b). Therefore, G is a tournament graph. It is well known [14] that if there is a cycle in a tournament graph G, then there is also a cycle of length 3 in G. Thus, it suffices to search for cycles of length 3.

An integer linear program via tree decompositions.

We now propose a formulation that reduces the number of transitivity constraints by exploiting the structure of the location graph. In particular, given a tree decomposition 𝒯=(T,{Xt}tV(T)) of , we modify 𝖨𝖫𝖯1 by using Ut={(p,q,r):{p,r}[Xt]2,qXt,qp,qr} instead of U. Thus, we obtain the following formulation (𝖨𝖫𝖯2):

minimize(p,q,r)iRbi (2a)
subjectto xpq =1xqp (p,q)tV(T)[Xt]2, (2b)
xpr xpq+xqr1 (p,q,r)tV(T)Ut, (2c)
bi xqp+xqr1 (p,q,r)iR, (2d)
bi xpq+xrq1 (p,q,r)iR, (2e)
xpq {0,1} tV(T)(p,q)Xt2,pq, (2f)
bi {0,1} (p,q,r)iR (2g)

In other words, instead of introducing transitivity constraints for every triplet of locations in U, we restrict the transitivity constraints to triplets of locations that appear together in at least one bag. The intuition behind this formulation is the following. Consider a separation (A,B) in with a separator AB. It is possible to find a turn-optimal ordering of by separately finding turn-optimal orderings of [A] and [B] with the property that the ordering of AB is consistent in both orderings. In particular, programs for [A] and [B] need to share only constraints for vertices in AB. Note that this intuition works only if we apply one separator to the location graph. For example, if we want to solve [A] and [B] recursively, we need to separate throughout the recursion, as vertices can be part of multiple separators across different recursion steps. In this case, orderings of separators that are consistent for specific separations might be in conflict with each other. We show that a conflict between multiple separations cannot happen if we use a tree decomposition for the separation of .

Theorem 11.

Let be an event graph. If x is an optimal solution to 𝖨𝖫𝖯2, then x implies a turn-minimal ordering of the locations in .

Proof.

First, observe that if the variables of type xpq indeed form a valid total ordering, then every possible turn is counted correctly by the variables bi. Specifically, for every triplet (p,q,r)R, the variables xpq (xqp) and xqr (xrq) exist since every triplet in R forms a path of length 2 in , and every edge in is contained in at least one bag due to (T2). Thus, it remains to show that the variables of type xpq model a valid total ordering.

Consider the directed graph G whose vertices correspond to the vertices in and that has a directed edge (p,q) if and only if xpq=1. The underlying undirected graph of G is a supergraph of , and the tree decomposition 𝒯 of is also a valid tree decomposition of G. Note that if G is acyclic, then the variables of type xpq model a valid ordering. Towards a proof by contradiction, suppose that this is not the case and that G does contain a cycle. Let C be a shortest cycle in G. If C has length 3, then C is a clique and due to (P2), the tree T has a node t such that CXt. Due to constraints (1c), however, for every bag Xi of 𝒯, the graph G[Xi] is acyclic. Hence, C is a cycle of length at least 4.

We claim that every bag of 𝒯 contains at most two vertices of C. Otherwise, there would be two vertices u and w of C that are not consecutive along C but, due to constraints (2f), the graph G would contain the edge (u,w) or the edge (w,u). In the first case, the path from w to u along C plus the edge (u,w) would yield a directed cycle. In the second case, the path from u to w along C plus the edge (w,u) would also yield a directed cycle. In both cases, the resulting cycle would be shorter than C (since u and w are not consecutive along C). This yields the desired contradiction and shows our claim.

Note that 𝒯 restricted to C is also a tree decomposition. However, since every bag contains at most two vertices of C, the restricted tree decomposition would have width 1, which is a contradiction since every tree decomposition of a cycle has width at least 2. Thus, the directed cycle C does not exist, and G is acyclic. Note that this formulation requires only 𝒪(tw()2|V()|) variables and 𝒪(tw()3|V()|) many constraints. This is a significant improvement over 𝖨𝖫𝖯1 if tw() is small, which can be expected since train infrastructure is usually sparse and “tree-like”.

6 Experimental Analysis

We tested the effectiveness of the reduction rule and the runtime of our formulations on an anonymized and perturbed dataset with 19 instances provided by DB InfraGO AG; see Figure 6 for an overview of the dataset. Our computations show that the minimum number of turns is between 0 and 5 in the provided dataset. We implemented our algorithms in the programming language Python. We used Networkx [11] to handle most of the graph operations and Gurobi (version 12.0.1) [9] to solve the integer linear programs. All experiments were conducted on a laptop running Fedora 40 with Kernel 6.10.6 using an Intel-7-8850U CPU with four physical cores and 16 GB RAM.

Figure 6: Left: Instances with respect to the number of events and the number of locations. Right: The histogram depicts the frequency of instances (y-axis) with a given number of trains (x-axis) in the dataset; e.g., there are five instances with five trains.

Effectiveness of the reduction rule.

Our implementation of Reduction Rule 1 is restricted to exhaustively contract chains. But even with this restriction, the reduction rule proves to be effective on the provided dataset. On average, the number of locations was reduced by 75%, where the best result was a reduction by 89% (instance 50-4) and the worst result was a reduction by 55% (instance 20-3). A full evaluation is shown in Figure 7.

Figure 7: Results of the effectiveness of applying contractions, restricted to contracting chains. The bar diagram shows the number of locations in each instance before and after contraction.

Runtime of the ILPs.

Each formulation was implemented with only one variable for each unordered pair of locations and without constraints (1b). Instead, if we created variable xpq for the unordered pair {p,q} and xqp was needed in the formulation, we substituted 1xpq for xqp. Since the computation of an optimal tree decomposition is 𝖭𝖯-hard, we used the Min-Degree Heuristic implemented in Networkx to compute a tree decomposition for 𝖨𝖫𝖯2. The additional time needed for computing this tree decomposition was counted towards the runtime of 𝖨𝖫𝖯2. We tested the cutting plane method and 𝖨𝖫𝖯2 on the original instances which we call initial instances and the instances that were reduced by our implementation of Reduction Rule 1 which we call reduced instances. We imposed a time limit of one hour on every experiment. The result of each experiment is the average value over 5 repetitions of the experiment. The cutting plane approach on the initial instances was able to solve 11 out of 19 instances. An instance was either always solved to optimality or never solved to optimality across all repetitions of the experiment. The largest instance that was solved to optimality contained 465 locations (and 19 trains) and was solved in 3509 s. The smallest instance that was not solved within the time limit contained 277 locations (and 8 trains). In contrast, the cutting plane approach was able to solve every reduced instance within 70 s. Applied to the reduced instances, the cutting plane approach was 625 times faster than when applied to the initial instances (averaged over those that were solved within the time limit). See Figure 8 for more details on the performance of the cutting plane approach.

Figure 8: Runtimes of the cutting plane approach (left) and of 𝖨𝖫𝖯2 (right), on the initial and the reduced instances.

𝖨𝖫𝖯2 solved every instance (initial or reduced) in less than a second (see Figure 8 for details). Still, the reduction helped, making 𝖨𝖫𝖯2 on average 3.98 times faster than on the initial instances. On the reduced instances, 𝖨𝖫𝖯2 was on average 103 times faster than the cutting plane approach on the reduced instances (and 22,845 times faster than the cutting plane approach on the initial instances).

7 Conclusion and Future Work

In this paper we have considered the problem of visualizing general event graphs as time-space diagrams. We established a connection between minimizing the number of turns in a time-space diagram and Maximum Betweenness, we proposed a preprocessing method to reduce the size of event graphs, and proposed two different integer linear program formulations.

We evaluated the performance of our algorithms on a real-world data set and observed that our best algorithms were able to solve every instance within one second. This suggests that turn-optimal time-space diagrams can be used in a real-time environment in practice. This can facilitate dispatching and the development of dispatching software.

Future work includes evaluating the usefulness and comprehensibility of the generated drawings in a real-life scenario, as well as exploring alternative optimization criteria that may yield improved visualizations. Secondary optimization steps that are applied as a post-processing to a turn-optimal drawing such as minimizing the number of crossings while keeping the ordering of locations might produce even better drawings. Since event graph visualizations represent time schedules, changes in the underlying schedule can lead to significant shifts in layout. An important direction for future work is developing techniques to preserve the user’s mental map during such updates.

References

  • [1] Per Austrin, Rajsekar Manokaran, and Cenny Wenner. On the NP-hardness of approximating ordering-constraint satisfaction problems. Theory of Computing, 11(10):257–283, 2015. doi:10.4086/toc.2015.v011a010.
  • [2] Giuseppe Di Battista and Roberto Tamassia. On-line planarity testing. SIAM Journal on Computing, 25(5):956–997, 1996. doi:10.1137/S0097539794280736.
  • [3] Hans L. Bodlaender. A partial k-arboretum of graphs with bounded treewidth. Theoretical Computer Science, 209(1-2):1–45, 1998. doi:10.1016/S0304-3975(97)00228-4.
  • [4] Benny Chor and Madhu Sudan. A geometric approach to betweenness. SIAM Journal on Discrete Mathematics, 11(4):511–523, 1998. doi:10.1137/S0895480195296221.
  • [5] Thomas Christof, Michael Jünger, John Kececioglu, Petra Mutzel, and Gerhard Reinelt. A branch-and-cut approach to physical mapping of chromosomes by unique end-probes. Journal of Computational Biology, 4(4):433–447, 1997. doi:10.1089/cmb.1997.4.433.
  • [6] Thomas Christof, Marcus Oswald, and Gerhard Reinelt. Consecutive ones and a betweenness problem in computational biology. In Int. Conf. Integer Programming & Combin. Optimization, pages 213–228, 1998. doi:10.1007/3-540-69346-7_17.
  • [7] Vladimir Filipović, Aleksandar Kartelj, and Dragan Matić. An electromagnetism metaheuristic for solving the maximum betweenness problem. Applied Soft Computing, 13(2):1303–1313, 2013. doi:10.1016/j.asoc.2012.10.015.
  • [8] Rihab Gorsane, Khalil Gorsan Mestiri, Daniel Tapia Martinez, Vincent Coyette, Beyrem Makhlouf, Gereon Vienken, Minh Tri Truong, Andreas Söhlke, Johann Hartleb, Amine Kerkeni, Irene Sturm, and Michael Küpper. Reinforcement learning based train rescheduling on event graphs. In 26th Int. Conf. Intell. Transport. Syst. (ITSC), pages 874–879. IEEE, 2023. doi:10.1109/ITSC57777.2023.10422531.
  • [9] Gurobi Optimization, LLC. Gurobi Optimizer Reference Manual, 2024. URL: https://www.gurobi.com.
  • [10] Carsten Gutwenger and Petra Mutzel. A linear time implementation of spqr-trees. In Joe Marks, editor, 8th Int. Symp. Graph Drawing (GD), volume 1984 of LNCS, pages 77–90. Springer, 2000. doi:10.1007/3-540-44541-2_8.
  • [11] Aric A. Hagberg, Daniel A. Schult, and Pieter J. Swart. Exploring network structure, dynamics, and function using NetworkX. In 7th Python Sci. Conf. (SciPy), pages 11–15, 2008. doi:10.25080/TCWV9851.
  • [12] John Hopcroft and Robert Tarjan. Algorithm 447: efficient algorithms for graph manipulation. Commun. ACM, 16(6):372–378, 1973. doi:10.1145/362248.362272.
  • [13] Yury Makarychev. Simple linear time approximation algorithm for betweenness. Operations Research Letters, 40(6):450–452, 2012. doi:10.1016/j.orl.2012.08.008.
  • [14] John W. Moon. On subtournaments of a tournament. Canadian Mathematical Bulletin, 9(3):297–301, 1966. doi:10.4153/CMB-1966-038-7.
  • [15] Petra Mutzel. The SPQR-tree data structure in graph drawing. In Jos C. M. Baeten, Jan Karel Lenstra, Joachim Parrow, and Gerhard J. Woeginger, editors, 30th Int. Colloq. Automata, Languages & Programming (ICALP), volume 2719 of LNCS, pages 34–46. Springer, 2003. doi:10.1007/3-540-45061-0_4.
  • [16] Jaroslav Opatrny. Total ordering problem. SIAM Journal on Computing, 8(1):111–114, 1979. doi:10.1137/0208008.
  • [17] Christos H. Papadimitriou and Mihalis Yannakakis. Optimization, approximation, and complexity classes. Journal of Computer and System Sciences, 43(3):425–440, 1991. doi:10.1016/0022-0000(91)90023-X.
  • [18] Aleksandar Savić. On solving the maximum betweenness problem using genetic algorithms. Serdica Journal of Computing, 3(3):299–308, 2009. doi:10.55630/sjc.2009.3.299-308.
  • [19] Aleksandar Savić, Jozef Kratica, Marija Milanović, and Djordje Dugošija. A mixed integer linear programming formulation of the maximum betweenness problem. European Journal of Operational Research, 206(3):522–527, 2010. doi:10.1016/j.ejor.2010.02.028.

Appendix A Complexity Results for the Turn-Minimization Problem

Betweenness is the decision version of Maximum Betweenness which asks whether an ordering exists that satisfies all restrictions. Betweenness was shown to be 𝖭𝖯-hard by Opatrny [16]. To prove NP-hardness of Turn Minimization we provide a simple reduction from Betweenness which can be used to derive that Turn Minimization is also hard to approximate with constant (multiplicative or additive) factor and 𝗉𝖺𝗋𝖺-𝖭𝖯-hard for the natural parameter, the number of turns.

To prove the second part of the theorem, ie., that Turn Minimization is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard if parameterized by the vertex cover number of the location graph, we use a reduction from MaxCut. The decision version of MaxCut asks whether there is a cut of size at least k in a given graph.

Theorem 7 (). [Restated, see original statement.]

Turn Minimization

  1. (i)

    is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard with respect to the natural parameter, the number of turns,

  2. (ii)

    is 𝗉𝖺𝗋𝖺-𝖭𝖯-hard with respect to the vertex cover number of the location graph,

  3. (iii)

    does not admit polynomial-time multiplicative or additive approximation algorithms unless 𝖯=𝖭𝖯.

Proof.

Let (S,R) be an instance of the Betweenness problem. We construct an instance for Turn Minimization corresponding to (S,R). Let S be the set of locations of the event graph that we want to construct. In order to construct the event graph , we consider R in an arbitrary but fixed order, where we let the i-th element in the order be denoted by (ai,bi,ci). For each triplet (ai,bi,ci)R, we construct a path Ξi in which is composed of three events Ξi=vi1,vi2,vi3 such that (vi1)=ai, (vi2)=bi, (vi3)=ci and t(vi1)<t(vi2)<t(vi3). This path Ξi can be considered as a train moving from location ai to ci over bi.

Claim 12.

Using this transformation, (S,R) has a valid ordering , satisfying all restrictions in R if and only if the transformed instance can be drawn as a time-space diagram Γ without any turns.

Proof.

Let (S,R) be a Betweenness instance with a valid ordering . If arranging the locations of on levels from top to bottom according to , for each triplet (ai,bi,ci)R it holds that either aibici or cibiai. By construction each Ξi corresponding to a constraint (ai,bi,ci)R is a path of events with three consecutive locations ai, bi, ci, thus Ξi is either monotonically increasing or decreasing in Γ. Therefore, no turn occurs.

Conversely, assume there is a turn-free drawing Γ of the transformed instance (,Y). Let be the ordering of S implied by the mapping y of Γ.

Now, assume that is violates a constraint in (ai,bi,ci)R. Thus, bi is not between ai and ci in . Then, in the corresponding path Ξi the location bi is also not between ai and ci in the mapping y. Therefore, y(bi) is the smallest/largest level of the three levels y(ai), y(bi), y(ci), implying a turn in Γ; a contradiction.

In the reduction, we have shown that we can decide Betweenness by testing whether there are no turns in the instance for Turn Minimization obtained in the transformation. This immediately eliminates the possibility of a parameterized algorithm (unless 𝖯=𝖭𝖯) whose only parameter is the number of turns as we would then be able to decide Betweenness in polynomial time. Thus, we have shown (i).

Approximation algorithms with a multiplicative or constant additive factor are also impossible (unless 𝖯=𝖭𝖯) for similar reasons. A multiplicative α-approximation algorithm is ruled out by the fact that such an approximation algorithm would have to solve the cases with 0=0α turns optimally.

If there was an additive β-approximation algorithm for a βpoly(|V()|), we could copy each gadget β+1 times. By duplicating the gadgets β+1 times, a turn in one gadget causes all other copies of the gadget to have a turn as well. Thus, the number of turns is divisible by β+1. If there was an optimal mapping from locations to levels without turns, the additive algorithm would also have to return the optimal value, since the only number in the range {0,β} that is divisible by β+1 is 0, implying that we could again use this algorithm to decide Betweenness. Thus, we have shown (iii).

In order to show (ii), we carry out a simple reduction from MaxCut. Let (G,k) be an instance to MaxCut. To transform (G,k) into an instance of Turn Minimization we construct the following event graph . Let z be an auxiliary vertex and let V(G){z} be the locations in . For each {u,v}E(G), we add a train line corresponding to locations (u,z,v) into .

Claim 13.

Using the transformation as described above, (G,k) has a cut of size k if and only if the transformed instance can be drawn as a time-space diagram with nk turns.

Proof.

Let (G,k) be a MaxCut instance and let (S,T) be a cut of size k in G with C={{s,t}:sS,tT}. We construct an ordering of the locations of in the following way. Every vertex in S is placed below z and every vertex in T is placed above z in an arbitrary order. Since contains only train lines of the form (u,z,v), for each {u,v}E(G), this corresponds to a drawing of , where every train line corresponding to an edge in C is drawn without a turn, and every train line whose edge is either contained in S or in T is drawn with a turn. Since (S,T) is a cut of size k, this drawing has nk turns.

Conversely, let be the transformed instance, let Γ be a drawing of with nk turns and let be the ordering of locations of implied by Γ. We set S={sV(()):sz} and T={tV(()):zt}. The size of the resulting cut (S,T) is k, which can be shown analogously to the previous argument. Note that this transformation results in a location graph of that is a star graph with z in the center. Since a star graph has a vertex cover number of 1, there is no algorithm parameterized by the vertex cover number, unless 𝖯=𝖭𝖯.

In order to show Theorem 8, we use a specific type of tree decomposition. We call a tree decomposition 𝒯=(T,{Xt}tV(T)) nice, if T is rooted at a leaf node r, the leaf nodes in T have empty bags, and all other nodes are one of the three following different types. A node t is of type introduce if t has exactly one child c, and Xt=Xc{v} for some vXc. Similarly, a node t is of type forget, if t has exactly one child c, and Xc=Xt{v} for some vXt. The third type is a join node, which is a node t with two children i,jV(T) whose bags contain the same vertices of V, i.e., Xt=Xi=Xj. Further, we require that the root node r is of type forget and that every leaf node in T is associated with an empty bag. Given an arbitrary tree decomposition, a nice tree decomposition of the same graph can be computed in polynomial time preserving the width of the given decomposition such that this nice tree decomposition contains 𝒪(tw(G)n) many nodes [3].

Theorem 8 (). [Restated, see original statement.]

Let be an event graph, and let be its augmented location graph. Computing a turn-optimal time-space diagram of is fixed-parameter tractable with respect to the treewidth of .

Proof.

We begin with introducing notation. In the following we refer to the time-space diagram simply as “drawing” and for the sake of brevity we say “a drawing of location graph ” where we mean the drawing of restricted to the locations contained in . Given a strict total order on a finite set S, the rank(b) of an element bS is the position in the unique enumeration of S such that for each pair ab, a is enumerated before b. Thus, rank(b)=|{aSab}|+1.

Let 𝒯=(T,{Xt}tV(T)) be a nice tree decomposition of rooted at some rV(T). For some tV(T), we define the subgraph t of to be the graph induced by the union of bags contained in the subtree of T rooted at t. For instance, the induced graph r with respect to the subtree rooted at the root node r is precisely .

Further, let πt be an order of the vertices in the bag Xt. We say that a drawing respects πt if the vertices in Xt are drawn such that for all p,qXt with pπtq vertex p is drawn above vertex q (i.e., is assigned a higher level). With πpit we denote the order πt which is extended by a vertex p such that p has rank(p)=i within the extended order πpit and all other vertices in the order that previously had a rank of at least i now have their rank increased by 1. Additionally, let πt be an order of the vertices in the bag Xt and let c be a child of t with I=XtXc. We write πt|c for the order πt restricted to the vertices in I. Lastly, we define b(p,πt) to be the number of turns for which p is one of the three locations (pi1,pi,pi+1) of a turn in a drawing of [Xt] respecting πt. Similarly, we write b(Xt,πt) for the total number of turns occurring in a drawing of [Xt] respecting the order πt, where all three locations (pi1,pi,pi+1) of a turn are contained in Xt. Note that each drawing of [Xt] respecting πt has the same number of turns since πt dictates an ordering on every vertex in Xt.

Now, let be a given augmented location graph and let 𝒯=(T,{Xt}tV(T)) be a nice tree decomposition of rooted at a leaf rV(T). We define D[t,πt] to be the number of turns in a turn-optimal drawing of t respecting the order πt. Therefore, D[r,πr] corresponds to the number of turns of a turn-optimal drawing of , since r is the root of T and r is associated with a leaf bag Xr=.

We show how D[t,πt] can be calculated by the following recursive formulas depending on the node type of t. Based on this recursive formulation, the actual optimal ordering of the locations in can be extracted via a straightforward backtracking algorithm.

Leaf node (except root):

Since the associated bag Xt of a leaf node t is empty, t is an empty graph and therefore the minimum number of turns of a turn-optimal drawing of t is D[t,πt]=0.

Introduce node:

Let p be the vertex that has been introduced in node t, and let c be the only child of t, then

D[t,πt]=D[c,πt|c]+b(p,πt).

Inductively, D[c,πt|c] corresponds to the number of turns of a turn-optimal drawing of c respecting the order πt restricted to vertices in Xc. The node t extends the graph c by the vertex p, introducing edges between p and vertices N(p)Xt that can cause turns including p. These turns are counted by b(p,πt). Since πt dictates the relative position of every vertex in N[p], a turn-optimal drawing of t respecting πt must contain every newly introduced turn.

Note that we count a turn at most once in this setting: First, the vertex p is introduced exactly once in t by the definition of a nice tree decomposition. Further, by the definition of b, we count a turn only if one location of its consecutive events vi1,vi,vi+1 is p. Therefore, during the computation of D[c,πt], the turns involving p have not been counted previously.

Forget node:

Let Xt=Xc{p} be the bag of t, where p is the vertex that has been forgotten in node t and where c is the only child of t, then

D[t,πt]=min{D[c,πpit]:i=1,,|Xc|}.

At node t, we remove vertex p from the bag Xc, therefore t=c. The ordering πt dictates the drawing for [Xc] in a turn-optimal drawing in t except for p. Thus, the number of turns of a turn-optimal drawing of t respecting πt must be a turn-optimal drawing in c respecting the order πt, where p is inserted into the order πt for some rank(p)=i.

Note that every turn involved in a turn-optimal drawing respecting πpit for an optimal i is accounted for precisely once since p be can forgotten only once. Since p was forgotten, Xt is a separating set that separates p from every other vertex in t, implying that the neighbourhood of p was already processed in c. Further, since the locations of every possible turn are a triangle in , we know that there is an already processed bag that contains all three locations of consecutive events vi1, vi, vi1 that can cause a turn.

Join node:

Let i and j be the two children of node t, then we can calculate the number of turns in a drawing of Gt respecting πt by

D[t,πt]=D[i,πt]+D[j,πt]b(Xt,πt).

At a join node, two independent connected components of T are joined, where i and j have only vertices in Xt in common. By induction, D[i,πt] and D[j,πt] contain the number of turns in a turn-optimal drawing in i and a turn-optimal drawing in j, where both drawings respect πt. Consequently, by summing the number of turns in both drawings i and j, we count turns occurring in Xt twice. Therefore, we need to subtract turns whose three corresponding vertices are contained in Xt. Further, note that no new vertex is introduced in a join node, thus no new turn can occur.

With the description of the recursive formulation of D[t,πt], we have shown that a turn (pi1,pi,pi+1) in a turn-optimal drawing is counted at least once in an introduce node of the last introduced vertex p of (pi1,pi,pi+1). We have also argued in the description of the forget node that a turn at p is counted at most once. Therefore, we count every turn exactly once in a drawing calculated by D[r,], concluding the correctness of the algorithm.

As for the runtime, note that b(p,πt) can be computed in 𝒪(|Xt|2) time by annotating every clique {p,q,r} in corresponding to a potential turn by the number of distinct consecutive event triplets mapping to locations p, q, and r. Since p is involved in each clique, we can enumerate every clique {p,q,r} in 𝒪(|Xt|2) time and due to the annotation, a clique can be processed in constant time. In order to count the total number of turns b(Xt,πt) in a bag Xt, we need 𝒪(|Xt|3) time. Assuming the algorithm operates on a nice tree decomposition 𝒯 of width tw(), there are 𝒪(tw()n) many bags in 𝒯. For a node t in the tree decomposition, we have to guess 𝒪((tw()+1)!) many orders. If t is a leaf node, it can be processed in constant time. Given an order πt, we can compute any introduce, forget, or join node in 𝒪(tw()3) time, yielding an overall runtime of 𝒪((tw()+1)!tw()4n).