• Keine Ergebnisse gefunden

Given interval and intersection lengths

4 Canonical representation of interval graphs

Corollary 4.4.4. Canonical unit interval representations of proper interval graphs can be com- com-puted in FL

4.5 Constrained interval and intersection lengths

4.5.2 Given interval and intersection lengths

LetG be a graph, and let the functions ℓ: V(G) → N+and s: E(G)→ N+specify the desired interval and intersection lengths, respectively. In this section, a linear-time and a logspace algorithm are presented that both construct an(ℓ,s)-respecting interval representation ofG, or detect that such a representation does not exist.

Define the graphG,son the same vertex set asGby E(G,s) ={{u,v} ∈E(G)⏐u≬,sv} , and call the connected components ofG,stheoverlap componentsof G.

4.5 Constrained interval and intersection lengths The next lemma shows that(ℓ,s)-respecting interval representations of≬,s-connected graphs are unique up to reflection, just as Lemma4.2.1shows that the interval models of

≬-connected hypergraphs are unique up to reflection. Indeed, the proofs use the same ideas.

Lemma 4.5.4. Given a graph G and two functions ℓ: V(G) → N+ and s: E(G) → N+ such that G,s is connected, it is possible in linear time (resp., in logspace) to compute an (ℓ,s)-respecting interval representationα: V(G)→ I of G, or to detect that none exists. More-over,I is unique up to reflection.

Proof. Letv1,v2, . . . ,vN be a walk inG,sthat visits every vertex at least once; such a walk can be constructed in linear time using depth first search or in logspace using Reingold’s universal exploration sequences [Rei08]. The following algorithm computes an interval representation α: V(G)→ I ofGby moving along this walk. At each step of the walk, compute an interval Ik = [pk,pk+ℓ(vk)−1] for vk. After that, let α(vk) = Ik, if there is no j< k with vj = vk. Define p1 = 1 and p2 = ℓ(v1)−s(v1,v2) +1. Note that after I1has been placed, there are only two possibilities for I2 that respect(ℓ,s); see Figure4.8 for an illustration. After that, all further intervals are completely determined because Lemma4.5.3 allows to detect whether the next interval Ik has to overlap Ik1from the same side as Ik2. This allows to define

pk =

{pk1−ℓ(vk) +s(vk1,vk) if Ik overlapsIk1 from the left, and pk1+ℓ(vk1)−s(vk1,vk) otherwise.

Note that Ik can be computed from the walk and the functions ℓand s, remembering only the two previous intervals; thus αcan be obtained in logspace.

In a post-processing step, check thatαis indeed an(ℓ,s)-respecting interval represen-tation of G. Additionally, shift the resulting intervals such that 1 becomes the smallest point.

The uniqueness up to reflection follows from the fact that the only arbitrary decision (except shifting) was to placeα(v2)right ofα(v1).

α(vk1) α(vk)

ℓ(vk1)

ℓ(vk) ℓ(vk)

s(vk1,vk) s(vk1,vk)

Figure4.8: Proof of Lemma4.5.4: Ifvk,s vk1, and if α(vk1) is already determined, there remain only the two dashed possibilities forα(vk).

The next step is to generalize Lemma4.5.4to the case thatG,sis not connected. We can assume that there are no vertices v and v such that both v ⊆,s v and v,s v hold; otherwise compute an (ℓ,s)-respecting interval representationαforG\ {v}and extend it by v ↦→ α(v)afterwards. LetC = {G1, . . . ,Gk}be the connected components of G,s. Define the binary relation≤,s onC that has Gi,s Gj if i = j or if there are vertices u ∈ V(Gi) and v ∈ V(Gj)such that u ⊆,s v. The latter implies that, for any (ℓ,s)-respecting interval representation α ofG, the intervaluGiα(u)is contained in

some slotS⊆α(v)ofα(Gj), because otherwise there would be an overlap-path fromα(Gi) toα(Gj). Thus≤,s is a partial order on the overlap components ofG, and each overlap component has a unique smallest successor. IfGis connected, the graph(C,≤,s)is also connected; removing reflexive and transitive edges results in a rooted treeT,s, which will be called theoverlap component treeofG.

Theorem 4.5.5. Given a graph G and two functions ℓ: V(G) → N+and s: E(G) → N+, it is possible in linear time (resp., logspace) to compute an(ℓ,s)-respecting interval representation α: V(G) → I of G, or to detect that none exists. Moreover, for any(ℓ,s)-respecting interval representation α: V(G) → I of G, there is a hypergraph isomorphism φ from I toI with φ(

α(v)) =α(v)for all v∈V(G).

Proof. We may assume thatGis connected, otherwise consider its connected components separately and concatenate their representations afterwards.

The algorithm works as follows: As pre-processing steps, it computes the connected componentsC ={G1, . . . ,Gk}ofG,s, an (ℓ,s)-respecting interval representationαi for each Gi ∈ C, and the overlap component tree T,s. The main part of the algorithm constructs an(ℓ,s)-respecting interval representation ofGby combining appropriately shifted copies of the representations of the overlap components. This is done in a depth-first traversal of the overlap component tree. Each overlap component Gi is assigned an offsetoi by which its representation is shifted. The representation of the root componentGris not shifted, i.e.,or=0. For each other overlap component Gi, compute the offsetoi as the sumoi =oj+ni+si, where

• oj is the offset of the parent Gj ofGi,

• ni is the number of points in the interval model αj(Gj) that are to the left of the slotSthat should contain the image ofGi according to⊆,s, and

• si is the sum of the model sizes of all previously visited siblings ofGi, for which

,s indicates that their images should be contained in the same slotSofα(Gj)as the image ofGi.

The model sizesni andsi are available from the interval representations of the overlap components. Figure4.9shows an example. For a vertexv∈V(G), letGiv be the overlap component that containsv. Then the algorithm checks whetherα(v) =αiv(v) +oiv is an (ℓ,s)-respecting interval representation of Gand outputsαif this is the case.

1 2 3 4 5 6 7 8 9 10 11 12

α(G1) α(G4)

Figure4.9: Proof of Theorem4.5.5: The offseto4for the overlap componentG4is the sum of the offseto1=0 of its parentG1, the numbern4=

{[1, 3]}⏐⏐=3 of points inα1(G1)left of the slot S= [4, 10]that should contain the image ofG4, and the sums4 =2 of model sizes of previously handled siblings ofG4 that are contained in the same slot, resulting ino4=5.

4.5 Constrained interval and intersection lengths IfGadmits an(ℓ,s)-respecting interval representation, then this algorithm will find one: Each component has a unique representation up to reflection by Lemma 4.5.4, implying that they all have the same length; and in every (ℓ,s)-respecting interval representation of G, each overlap component must be placed in the appropriate slot of its parent overlap component.

In the construction of the representationα, the only arbitrary choices are the precise placement of overlap components within the slot of their parent component that contains them, the order of the connected components ofG, and whether the representations of the individual overlap components are reflected. All these choices can be transformed into one another by isomorphisms of the resulting interval system I, which is thus unique up to isomorphism. Moreover, for any (ℓ,s)-respecting interval representation α: V(G) → I of G, modifying the choices that result in α to match the choices that result in α specifies a hypergraph isomorphism φfromI toI with φ(

α(v))=α(v)for allv∈V(G).

It remains to show that the algorithm can be implemented in linear time or logspace.

Connected components can be found in linear time using depth first search, and in logspace using Reingold’s connectivity algorithm [Rei08]. The(ℓ,s)-respecting interval representations of the overlap components can be computed using Lemma4.5.4. The construction of the overlap component treeT,scan easily be implemented in logspace.

To obtain this tree in linear time, compute ≤,s by iterating over the edges of G, and remove reflexive and transitive arcs; see [HMR93, Proposition3.6] for how the latter is possible in linear time. Computing the offsets for shifting is clearly possible in linear time. To compute them in logspace, traverse the overlap component tree (see e.g. [Lin92]

for how to do this in logspace). During this traversal, store only the shift-offset oi for the current overlap componentGi; this is sufficient because the offsetoj =oi−ni−si of the parent componentGj ofGi can be recovered fromoi by recomputing the numbers ni andsi.