Path computation in multi-layer multi-domain networks: A language theoretic approach
PPath Computation in Multi-Layer Multi-DomainNetworks: A Language Theoretic Approach
Mohamed Lamine Lamali a, ∗ , H´elia Pouyllau a , Dominique Barth b a Alcatel-Lucent Bell Labs, Route de Villejust, 91620 Nozay, France b Lab. PRiSM, UMR8144, Universit´e de Versailles, 45, av. des Etas-Unis, 78035 VersaillesCedex, France
Abstract
Multi-layer networks are networks in which several protocols may coexist atdifferent layers. The Pseudo-Wire architecture provides encapsulation and de-capsulation functions of protocols over Packet-Switched Networks. In a multi-domain context, computing a path to support end-to-end services requires theconsideration of encapsulation and decapsulation capabilities. It appears thatgraph models are not expressive enough to tackle this problem. In this paper,we propose a new model of heterogeneous networks using Automata Theory. Anetwork is modeled as a Push-Down Automaton (PDA) which is able to capturethe encapsulation and decapsulation capabilities, the PDA stack correspondingto the stack of encapsulated protocols. We provide polynomial algorithms thatcompute the shortest path either in hops or in the number of encapsulationsand decapsulations along the inter-domain path, the latter reducing manualconfigurations and possible loops in the path.
Keywords:
Multi-layer networks, Pseudo-Wire, Push-Down Automata
1. Introduction
Most carrier-grade networks comprise multiple layers of technologies (e.g.Ethernet, IP, etc.). These layers are administrated by different control and/ormanagement plane instances. The Pseudo-Wire (PWE3) architecture [2] unifiescontrol plane functions in heterogeneous networks to allow multi-layer services(e.g. Layer 2 VPN). To this end, it defines encapsulation (a protocol is encapsu-lated into another) and decapsulation (a protocol is unwrapped from another)functions, called adaptation functions further in this paper. These functions ∗ Corresponding author
Email addresses: [email protected] (Mohamed LamineLamali), [email protected] (H´elia Pouyllau), [email protected] (Dominique Barth) c (cid:13) http://creativecommons.org/licenses/by-nc-nd/4.0/ c (cid:13) Published version: http: // dx. doi. org/ 10. 1016/ j. comcom. 2012. 11. 009 a r X i v : . [ c s . D S ] D ec uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009allow the emulation of services (e.g. Frame Relay, SDH, Ethernet, etc.) overPacket-Switched Networks (PSN, e.g. IP or MPLS).Prior to a service deployment in a multi-layer network, the resources must beidentified during the path computation process. The path computation musttake into account the adaptation function capabilities in order to explore allresources and to ensure the end-to-end service deployment. The authors of [1]defined the multi-segment Pseudo-Wire architecture for multi-domain networks.In [4], the authors mention the problem of path determination over such anarchitecture, stressing the importance of having path computation solutions.In such an architecture, the path computation should comply with protocolcompatibility constraint: if a protocol is encapsulated in a node, it must bedecapsulated in another node; the different encapsulation processes should betransparent to the source and target nodes. Thus, some nodes may be physicallyconnected but, due to protocol incompatibility, no feasible path (i.e., which com-ply with protocol compatibility) can be found between them. This constraintleads to non trivial characteristics of a shortest path [7]: i) it may involve loops(involving the same link several times but with different protocols); ii) its sub-paths may not be feasible. Computing such a path is challenging and cannotbe performed by classical shortest path algorithms.Currently, the configuration of these functions is manually achieved withineach network domain: when an encapsulation function is used, the correspond-ing decapsulation function is applied within the domain boundaries. In large-scale carrier-grade networks or in multi-domain networks, restricting the loca-tion of the adaptation functions to the domain boundaries might lead to ignorefeasible end-to-end paths leading to a signaling failure. Hence, in the pathcomputation process, it must be possible to nest several encapsulations (e.g.Ethernet over MPLS over SDH). A decapsulation should not be restricted tothe same domain as its corresponding encapsulation. This allows the explorationof more possible paths and new resources in the path computation.The problem we address is to compute the shortest feasible path either inthe number of nodes or in the number of involved (and possibly nested) adap-tation functions. The latter is motivated by two goals: i ) as such functionsare manually configured on router interfaces, minimizing their number wouldsimplify the signaling phase when provisioning the path; ii ) as our algorithmsdo not allow loops without adaptation functions (loops without encapsulationsor decapsulations are useless and can be deleted), reducing the number of adap-tation functions leads to reducing the number of loops. Reducing the numberof loops is important because if there are several loops involving the same link,the available bandwidth on this link may be exceeded.The authors of [14, 6] focused on the problem of computing a path in a multi-layer network under bandwidth constraints. In [16], we demonstrated that theproblem under multiple Quality of Service constraints is NP-Complete. In thispaper we demonstrate that the problem without QoS constraints is polynomial,and we provide algorithms to compute the shortest path. These algorithms usea new model of multi-layer networks based on Push-Down Automata (PDAs).The encapsulation and decapsulation functions are designed as pushes and pops2uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009in a PDA respectively, the PDA stack allowing to memorize the nested protocols.If the goal is to minimize the number of adaptation functions, the PDA is trans-formed in order to bypass sub-paths without adaptation functions. The PDA ortransformed PDA is then converted into a Context-Free Grammar (CFG) usinga method of [13]. A shortest word, either corresponding to the shortest path innodes or in adaptation functions, is generated from this CFG.This paper extends the work published in [15], providing the detailed proofsof the correctness of the algorithms and including new algorithms (transformingthe PDA, converting the PDA to a CFG, generating the shortest word). Further-more, the complexity analyses are refined and the total worst case complexityof the path computation is significantly reduced.This paper is organized as follows: Section 2 recalls the context of multi-layer multi-domain networks and the related work on path computation in suchnetworks and presents the proposed approach; Section 3 provides a model ofmulti-layer multi-domain networks and a formal definition of the problem; Sec-tion 4 explains how a network is converted into a PDA and provides the com-plexity of this transformation; finally, Section 5 gives the different methods thatcompute the shortest path in nodes or in encapsulations/decapsulation.In order to ease the paper reading, a table summarizing the used notationsis provided in Appendix A.
2. Path computation in Pseudo-Wire networks
Some standards define the emulation of lower layer protocols over a PSN(e.g. Ethernet over MPLS, [19], Time-Division Multiplexing (TDM) over IP,[21]). For instance, one node in the network encapsulates the layer 2 frames inlayer 3 packets and another node unwraps them. This allow to cross a part ofthe network by emulating a lower layer protocol, and thus to overcome protocolincompatibilities.The PWE3 architecture [2], as well as the multi-layer networking descriptionof [20], assumes an exhaustive knowledge of the network states. This assumptionis not valid at the multi-domain scale. Thus, the authors of [1] defines anarchitecture for extending the Pseudo-Wire emulation across multiple PSNssegments. The authors of [4] stress the importance of path determination insuch a context and suggest it to be an off-line management task. They alsosuggest to use the Path Computation Element architecture (PCE) [8], which isadapted to the multi-domain context. It could be a control plane container forsolution detailed in this paper. It would require protocol and data structureextensions in order to add encapsulation/decapsulation capabilities in the PCEdata model.
The problem of path computation in heterogeneous networks raised first atthe optical layer. Due to technology incompatibilities (different wavelengths,different encodings, etc.), it soon became clear that classical graph models can-not capture these incompatibilities thus forbidding classical routing algorithms3uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009to tackle this problem. The authors of [3] propose a
Wavelength Graph Model instead of the classical network graph models to resolve the problem of wave-length continuity. The authors of [23] propose an
Auxiliary Graph Model toresolve the problems of traffic grooming and wavelength continuity in heteroge-neous WDM mesh networks, this model is later simplified in [22]. The commonfeature of these works is that they model each physical device as several nodes,each node being indexed by a technology. The existence of an edge dependson the existence of a physical link, but also on the technology compatibility.In [11], the authors take into account the compatibility constraints on severallayers: wavelength continuity, label continuity, etc. They propose a
ChannelGraph Model to resolve the multi-layer path computation problem. The pro-posed models and algorithms take into account protocol and technology butignore the encapsulation/decapsulation (adaptation) capabilities. As they donot have a stack to store the encapsulated protocols, they cannot model thePWE3 architecture.In the PWE3 architecture, the compatibility between two technologies on alayer depends also on the encapsulated protocols on the lower layer. In [6], theauthors addressed the problem of computing the shortest path in the contextof the ITU-T G.805 recommendations on adaptation functions. They stress thelack of solutions on path selection and the limitations of graph theory to handlethis problem. The authors of [7] present the specificities of a multi-layer pathcomputation taking into account the encapsulation/decapsulation (adaptation)capabilities: the shortest path can contain loops and its sub-paths may not sat-isfy the compatibility constraints. They provide an example of topology whereclassical routing algorithms cannot find the shortest path because it contains aloop. In [14], the authors addressed the same problem in a multi-layer networkqualifying it as an NP-Complete problem. The NP-Completeness comes fromthe problem definition as they consider that the loops in the path can exceedthe available bandwidth, because if the path involves the same link several timesit may overload this link. They aim to select the shortest path in nodes andprovide new graph models allowing to express the adaptation capabilities. Theypropose a Breadth-First Search algorithm which stores all possible paths andselects the shortest one. This algorithm has an exponential time complexity.In the problem we consider, we exclude bandwidth constraints and propose asolution for minimizing the number of encapsulations and decapsulations. Ouralgorithm does not allow loops without adaptation functions, the only loopsthat may exist involve encapsulations or decapsulations. Thus, minimizing thenumber of adaptation functions in the path also leads to minimizing the numberof loops - and avoiding them if a loop-free feasible path with less encapsulationsexists.
In this work, we propose a new multi-domain multi-layer network modelwich takes into account encapsulation and decapsulation capabilities. To thebest of our knowledge no previous work has considered this problem at themulti-domain scale. It induces to go beyond the domain boundaries allowing4uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 multi-domain compatibility to determine a feasible inter-domain path : when anencapsulation for a given protocol is realized in one domain its correspondingdecapsulation must be done in another. It appears that PDAs are naturallyadapted to model the encapsulation and decapsulation capabilities, as push andpop operations easily model encapsulations and decapsulations, and the PDAstack can model the stack of encapsulated protocols. By using powerful toolsof Automata and Language Theory, we propose polynomial algorithms thatgenerate the shortest sequence of protocols of a feasible path. This sequenceallows to find the shortest feasible path.Furthermore, we consider two kind of objectives: either the well-known ob-jective of minimizing the number of hops or the objective of minimizing thenumber of adaptation functions. The latter is motivated by the fact that it isequivalent to minimize the number of configuration operations, which are oftendone manually and can be quite complex. It is also motivated by reducing thenumber of possible loops (as the number of adaptation functions involved in apath is correlated with the number of loops), and thus avoiding to use the samelink several times and to exhaust the available bandwidth on it.Figure 1 summarizes our proposed approach. It presents the different modelsleading to the shortest path and the algorithms computing them.I. Convert a multi-domain Pseudo-Wire network into a PDA,i. If the goal is to minimize the number of adaptation functions, trans-form the PDA to bypass the “passive” functions (i.e. no protocoladaptation),ii. Else let the PDA as is,II. Derive a CFG from the PDA or the transformed PDA,III. Determine the “shortest” word generated by the CFG,IV. Identify the shortest path from the shortest word.
Figure 1: Proposed approach to compute the shortest feasible path.
3. Multi-layer multi-domain network model
A multi-domain network having routers with encapsulation/decapsulationcapabilities can be defined as a 3-tuple: a directed graph G = ( V , E ) modelingthe routers of a multi-domain network, we consider a pair of vertices ( S, D ) in G corresponding to the source and the destination of the path we focus on; a finitealphabet A = { a, b, c, . . . } in which each letter is a protocol; an encapsulationor a decapsulation function is a pair of different letters in the alphabet A : • Figure 2(a) illustrates the encapsulation of the protocol x by the node U in the protocol y ; • Figure 2(b) illustrates that the protocol x is unwrapped by the node U from the protocol y ; • Figure 2(c) illustrates that the protocol x transparently crosses the node U (no encapsulation or decapsulation function is applied). Such pairs arereferred as passive further in this paper.We denote by ED and by ED the set of all possible encapsulation functions anddecapsulation functions respectively, (i.e., ED ⊂ A ). A subset P ( U ) of ED∪ED indicates the set of encapsulation, passive and decapsulation functions supportedby vertex U ∈ V . We define In ( U ) = { a ∈ A s.t. ∃ b ∈ A s.t. ( a, b ) or ( b, a ) ∈ P ( U ) } and Out ( U ) = { b ∈ A s.t. ∃ a ∈ A s.t. ( a, b ) or ( b, a ) ∈ P ( U ) } . The set T ( U ) = { a ∈ A s.t. ( a, a ) ∈ P ( U ) } is the set of protocols that can passivelycross the node U . (a) Encapsulation ofprotocol x in protocol y ,( x, y ) ∈ P ( U ) (b) Decapsulation of pro-tocol x from protocol y ,( x, y ) ∈ P ( U ) (c) Passivecrossing,( x, x ) ∈ P ( U )Figure 2: Different transitions when a protocol crosses a node U N = ( G = ( V , E ) , A , P ), a source S ∈ V , a destina-tion D ∈ V and a path C = S, x , U , x , . . . , U n − , x n , D where each U i is avertex in V and each x i ∈ A ∪ A (where A = { a : a ∈ A} ). • T C = x . . . x n represents the sequence of protocols which is used over thepath C . It is called the trace of C . For each x i : – x i = a and x i +1 = b or b , means that U i encapsulates the protocol a in b ( a, b, b ∈ A ∪ A ) – x i = a and x i +1 = b or b means that U i unwraps the protocol b from a – x i = a and x i +1 = a or a means that U i passively transports a • The transition sequence of C , denoted H C , is the sequence β , . . . , β n obtained from C s.t. for i = 1 ..n : – if x i = a ∈ A and x i +1 = b ∈ A or x i +1 = b ∈ A then β i = ( a, b ) – if x i = b ∈ A and x i +1 = a ∈ A \ { b } or x i +1 = a ∈ A \ { b } then β i = ( a, b )Note that the pair ( a, a ) , a ∈ A can appear in a transition sequence,as it represents a passive function. However, according the definitionabove, a pair ( a, a ) , a ∈ A cannot appear, as it is forbidden toencapsulate (and thus to decapsulate) a protocol a in itself. • The well-parenthesized sequence of C , denoted M C = β (cid:48) , . . . , β (cid:48) m , is ob-tained from H C by deleting each passive transition β i s.t. β i = ( a, a ) and a ∈ A Example.
Consider the path C = S, a, U, b, V, b, W, a, D in the network illus-trated by Fig. 3(a). The transition sequence corresponding to C is H C =( a, b ) , ( b, b ) , ( a, b ) and its trace is T C = abba . The well-parenthesized sequencefrom C is M C = ( a, b ) , ( a, b ).Let (cid:15) denotes the empty word, “ • ” indicates the concatenation operation,and H C denotes the transition sequence obtained from a path C as explainedabove. The following definitions give a formal characterization of the feasiblepaths. Definition 1.
A sequence M C from H C is valid if and only if M C ∈ L , where L is the formal language recursively defined by: L = (cid:15) ∪ (cid:91) ( x,y ) ∈A ( x, y ) • L • ( x, y ) • L Definition 2.
A path C is a feasible path in N from S to D if: • S, U , . . . , U n − , D is a path in G = ( V , E ) , • The well-parenthesized sequence M C from C is valid, • For each i ∈ { , . . . , n } : – if x i = a and x i +1 = b or b then ( a, b ) ∈ P ( U i ) – if x i = a and x i +1 = b or b then ( a, b ) ∈ P ( U i ) – if x i = a and x i +1 = a or a then a ∈ T ( U i )The language L of valid sequences is known as the generalized Dyck language [17]. It is well-known that this language is context free but not regular. Thus,push-down automata are naturally adapted to model this problem. Example.
The multi-domain network illustrated by Fig. 3(a) has 6 routers andtwo protocols labeled a and b . Adaptation function capabilities are indicatedbelow each node. For example, the node U can encapsulate the protocol a in theprotocol b (function denoted by ( a, b )) or can passively transmit the protocol a (function denoted by ( a, a )). In this multi-domain network, the only feasiblepath between S and D is S, a, U, b, V, ¯ b, W, a, D and involves the encapsulationof the protocol a in the protocol b by the node U , the passive transmission ofthe protocol b by the node V and the decapsulation of the protocol a from b bythe node W . (functions ( a, b ), ( b, b ) and ( a, b ) respectively). Problem definition.
As explained above, our goal is to find a feasible multi-domain path. Furthermore, we set as an objective function either the size ofthe sequence of adaptation functions or the size of the path in number of nodes.Hence, the problem we aim to solve can be defined as follows:min C | H C | or | M C | s.t. C is a feasible path
4. From the network model to a PDA
In this section, we address the conversion from a network to a PDA. Algo-rithm 1 takes as input a network N = ( G = ( V , E ) , A , P ) and converts it to aPDA A N = ( Q , Σ , Γ , δ, S A , Z , { D A } ), where Q is the set of states of the PDA,Σ the input alphabet, Γ the stack alphabet, δ the transition relation, S A thestart state, Z the initial stack symbol and D A the accepting state, (cid:15) is theempty string. The automaton A N from N is obtained as follows: • Create a state U x of the automaton for each U ∈ V and each x ∈ In ( U ),except for the source node S for which a single state S A is created, • The top of the stack is the last encapsulated protocol, • If the current state is U x then the current protocol is x ,8uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 • The adaptation functions will be converted into transitions in the PDA.A transition t ∈ δ is denoted ( U x , (cid:104) x, α, β (cid:105) , V y ) where U x ∈ Q is the stateof the PDA before the transition, x ∈ Σ is the input character, α ∈ Γ isthe top of the stack before the transition (it is popped by the transition), β ∈ Γ ∗ is the sequence of symbols pushed to the stack, and V y is thestate of the PDA after the transition. Thus if β = α then t is a passivetransition, if β = xα then t is a push of x , and if β = ∅ then t is a pop, • A passive transition of a protocol x across a node U is modeled as atransition without push or pop between the state U x and the followingstate V x . It is denoted ( U x , (cid:104) x, α, α (cid:105) , V x ), • An encapsulation of a protocol x in a protocol y by a node U is modeledas a push of the character x in the stack between the state U x and thefollowing state V y . It is denoted ( U x , (cid:104) x, α, xα (cid:105) , V y ) , • A decapsulation of y from x by a node U is modeled as a pop of theprotocol y from the stack. It is denoted ( U x , (cid:104) x, y, ∅(cid:105) , V y ). Algorithm 1
Convert a network to a PDAInput: a network N = ( G = ( V , E ) , A , P ), a source S and a destination D Output: push-down automaton A N = ( Q , Σ , Γ , δ, S A , Z , { D A } )(1) Σ ← A ∪ A ; Γ ← A ∪ { Z } (2) Create a single state S A for the node S (3) For each node U (cid:54) = S and each protocol x ∈ In ( U ), create a state U x (4) For each state U x s.t. ( S, U ) ∈ E and x ∈ Out ( S )Create a transition ( S A , (cid:104) (cid:15), Z , Z (cid:105) , U x )(5) For each link ( U, V ) ∈ E s.t. U (cid:54) = S and for each ( x, y ) ∈ P ( U ) and each α ∈ Γ \ { x } (5.1) If x ∈ T ( U ) ∩ In ( V ) Create a transition ( U x , (cid:104) x, α, α (cid:105) , V x ) { passivetrans. } (5.2) If x (cid:54) = y and y ∈ In ( V ) Create a transition ( U x , (cid:104) x, α, xα (cid:105) , V y ) { encap. } (6) For each link ( U, V ) ∈ E s.t. U (cid:54) = S and for each ( y, x ) ∈ P ( U )(6.1) If x ∈ In ( V ) Create a transition ( U x , (cid:104) x, y, ∅(cid:105) , V y ) { decap. } (7) Create a fictitious final state D A .(8) For each x ∈ In ( D ) and each α ∈ Γ \ { x } Create a transition( D x , (cid:104) x, Z , ∅(cid:105) , D A ) Complexity.
Each node U from the graph generates | In ( U ) | states, except thesource node S . A fictitious final state is added. Thus, the number of states is Note that, even if x = a ∈ A , the transition has the form ( U a , (cid:104) a, α, aα (cid:105) , V y ). Charactersin A are only used as input characters. Characters indexing states and pushed characters inthe stack are their equivalent in A . |V| − × |A| so in O ( |V| × |A| ). The worst case complexity ofalgorithm 1 is in O (max(( |V| × |A| ) , ( | E | × (( |A| × |ED| ) + |ED| ))))). We assumethat the network is connected, so | E | ≥ |V| −
1. Since ED is a subset of A ,then |ED| < |A| and |ED| < |A| . Thus, the upper bound complexity is in O ( |A| × | E | ), which is also an upper bound for the number of transitions. Proposition 1.
Considering a network N = ( G = ( V , E ) , A , P ) , a source S ∈V and a destination D ∈ V , the language recognized by A N is the set of tracesof the feasible paths from S to D in N . Proof.
Let a feasible path C = Sx U x . . . x i U i x i +1 . . . U n − x n D in a net-work N and its trace T C = x . . . x i x i +1 . . . x n leading to a valid sequence M C .We aim to demonstrate that: i ) T C is recognized by A N and ii ) U , . . . , U n − is a path in N and iii ) There exists a feasible path corresponding to T C in N if T C is recognized by the PDA A N . It is sufficient to show that C = S, x , U , x , . . . , U n − , x n , D is a feasible path in N if and only if T C is recog-nized by A N (i.e the final state is reached and the stack is empty).From C we deduce the following path in A N defined as a sequence of tran-sitions. This path begins with transitions: ( S A , (cid:104) (cid:15), Z , Z (cid:105) , ( U i ) x ) for each U i s.t. x ∈ In ( U i ). Hence, transition ( S A , (cid:104) (cid:15), Z , Z (cid:105) , ( U ) x ) belongs to this set.Then, the path in A N follows the order induced by T C , for each element in x , . . . , x n , we consider one or two transitions in A N as follows: • if x i = a then – if x i +1 = a or x i +1 = a consider the transition (( U i ) a , (cid:104) a, α, α (cid:105) , ( U i +1 ) a )where α ∈ Γ \ { a } , – if x i +1 = b or x i +1 = b consider the transition (( U i ) a , (cid:104) a, α, aα (cid:105) , ( U i +1 ) b ),where α ∈ Γ \ { a }• else (i.e., if x i = a ) then consider the transition (( U i ) a , (cid:104) a, b, ∅(cid:105) , ( U i +1 ) b ).Note that, if i = n then U i +1 = D .It is clear that this sequence of transitions is a path in A N recognizing thetrace T C . Since M C is a well parenthesized word, if x i = a then the headof the stack when reaching state ( U i ) x i contains aZ and when reaching state( U i +1 ) x i +1 , the head of the stack is reduced to Z . Then, when reaching state D A , the stack is empty.Conversely, we can show with a similar construction that any well recognizedword on a path in A N induces one unique trace T C of feasible paths in G from S to D . (cid:50) Example . Figure 3(b) is an example of output of algorithm 1. The algorithmtransforms the network illustrated by Fig. 3(a) into a PDA of Fig 3(b). Forinstance, the link (
U, V ) is transformed into the transitions ( U a , (cid:104) a, Z , aZ (cid:105) , V b )and ( U a , (cid:104) a, b, ab (cid:105) , V b ) (pushes) because the node U should encapsulate the pro-tocol a in the protocol b using the adaptation function ( a, b ) before trans-mitting to the node V . The link ( W, D ) is transformed into the transitions10uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009( W b , (cid:104) b, Z , bZ (cid:105) , D a ) and ( W a , (cid:104) b, a, ba (cid:105) , D a ) (pushes) according to the adapta-tion function ( a, b ). It is also transformed into the transition ( W b , (cid:104) b, a, ∅(cid:105) , D a )(pop) because the node W can decapsulate the protocol a from b using theadaptation function ( a, b ) before transmitting to the node D . The link ( V, W ) istransformed into the transitions ( V b , (cid:104) b, Z , Z (cid:105) , W b ) and ( V b , (cid:104) b, a, a (cid:105) , W b ) (pas-sive transitions) according the capability of the node V (adaptation function( b, b )).
5. The shortest feasible path
In section 4, we provided a method to build a PDA allowing to determinethe feasible paths. The next step is to minimize either the number of nodes orthe number of adaptation functions. The method to minimize the number ofnodes uses directly the PDA as described in section 5.1. But to minimize thenumber of adaptation functions, the PDA is transformed in order to bypass thesub-paths without any adaptation function, as detailed in section 5.2. Then, aCFG derived from the PDA (or the transformed PDA) generates words whoselength is equivalent to the number of nodes (or to the number of adaptations).An algorithm browses the CFG to determine the shortest word. Finally, anotheralgorithm identifies the multi-domain path corresponding to this shortest word.
The number of characters in a word accepted by the automaton A N is thenumber of links in the corresponding feasible path (each character is a protocolused on a link). Thus the step of automaton transformation (section 5.2) shouldbe skipped. The automaton A N is directly transformed into a CFG, then theshortest word is generated as described in section 5.3.2. The correspondingfeasible path is computed by algorithm 6 described in section 5.3.3. To enumerate only encapsulations and decapsulations in the length of eachword (and thus minimize adaptation functions by finding the shortest wordaccepted), a transformed automaton A (cid:48) N in which all sequences involving passivetransitions are bypassed must be determined. The length of the shortest wordaccepted by A (cid:48) N is the number of adaptation functions plus a fixed constant.Let us define Q a ( a ∈ A ) as Q a = { V x ∈ Q| x = a } , and let A aN be the sub-automaton induced by Q a . By analogy with an induced subgraph, an inducedsub-automaton is a multigraph with labeled edges such that the set of verticesis Q a and the set of edges is the set of transitions between elements of Q a . Sincethere are only passive transitions between two states in Q a , all paths in the sub-automaton are passive. Let define P ( U x , V x ) as the shortest path length between U x and V x . This length can be computed between all pairs of nodes in Q a usingthe Floyd-Warshall algorithm. Let Succ ( V x ) be the set of successors of V x inthe original automaton A N , i.e., Succ ( V x ) = { W y ∈ Q|∃ ( V x , (cid:104) x, α, β (cid:105) , W y ) ∈ δ } .11uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009Algorithm 2 takes as input A N and computes the transformed automaton A (cid:48) N = ( Q (cid:48) , Σ (cid:48) , Γ (cid:48) , δ (cid:48) , S A , Z , { D A } ). A (cid:48) N is initialized with the values of A N .Then, the algorithm computes the sub-automaton for each character x ∈ A (step (1)) and the length values P ( U x , V x ) for each pair of states in the sub-automaton (step (2)). Each path between a pair of states is a sequence of passivetransitions. If such a path exists (step (3.1)), the algorithm adds transitions to δ (cid:48) from U x to each state in Succ ( V x ) (steps (3.1.2) and (3.1.3)). These addedtransitions are the same that those which connect V x to its successors W y , butwith an input character indexed by the number of passive transitions between U x and V x , (i.e., P ( U x , V x )) plus one (indicating that there is a transition sequencewhich matches with a sequence of protocols xx . . . x of length P ( U x , V x ) + 1).The indexed character is added to the input alphabet Σ (cid:48) (step (3.1.1)). Algorithm 2
Transform automaton A N Input: push-down automaton A N = ( Q , Σ , Γ , δ, S A , Z , { D A } )Output: transformed push-down automaton A (cid:48) N =( Q (cid:48) , Σ (cid:48) , Γ (cid:48) , δ (cid:48) , S A , Z , { D A } ) Q (cid:48) ← Q , Σ (cid:48) ← Σ, Γ (cid:48) ← Γ, δ (cid:48) ← δ For each x ∈ A (1) Compute A xN (2) Compute the distance P ( U x , V x ) between all pairs of states U x and V x in A xN (3) For each U x ∈ Q x and each V x in Q x (3.1) If P ( U x , V x ) < ∞ { there is a path between U x and V x } (3.1.1) Add x P ( U x ,V x )+1 and x P ( U x ,V x )+1 to Σ(3.1.2) For each W y ∈ Succ ( V x ) \{ U x } and each ( V x , (cid:104) x, α, β (cid:105) , W y ) ∈ δ Add the transition ( U x , (cid:104) x P ( U x ,V x )+1 , α, β (cid:105) , W y ) to δ (cid:48) (3.1.3) For each W y ∈ Succ ( V x ) \{ U x } and each ( V x , (cid:104) x, α, β (cid:105) , W y ) ∈ δ Add the transition ( U x , (cid:104) x P ( U x ,V x )+1 , α, β (cid:105) , W y ) to δ (cid:48) Complexity.
Computing the sub-automaton (step (1)) is done in O ( | δ | + |Q| )by checking all the nodes and all the transitions. Computing the shortest pathlength between all pairs of states is done by the Floyd-Warshall algorithm in O ( |Q x | ). If x=y, there are at worst |A| − V x and W y in Q (transitions in the form ( U x , (cid:104) x, α, α (cid:105) , W x ) for all possible values of α except x — as the construction of the automaton forbids the encapsulation of a protocol x in x , and thus it is impossible to have x as current protocol and at the top ofthe stack in the same time). If x (cid:54) = y , there are at worst |A| transitions between V x and W y in Q (the pop ( V x , (cid:104) x, y, ∅(cid:105) , W y ) and the pushes ( V x , (cid:104) x, α, xα (cid:105) , W y )for all possible values of α except x ). And as | Succ ( V x ) | < |Q| , the steps(3.1.2) and (3.1.3) are bounded by O ( |Q| × |A| ). However, a state belongs toonly one sub-automaton, the complexity of algorithm 2 is therefore bounded by12uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 O (cid:0)(cid:80) x ∈A (cid:2) | δ | + |Q| + |Q x | + ( |Q x | × |Q| × |A| ) (cid:3)(cid:1) . And ∀ x ∈ A , |Q x | ≤ |A| (see algorithm 1 for the construction of the set of states Q ). Thus, the complex-ity of algorithm 2 is in O (cid:0) max (cid:0) |A| × ( | δ | + |Q| ) , |A| × |V| , |A| × |V| × |Q| (cid:1)(cid:1) ,which corresponds to O (cid:0) max( |A| × | E | , |A| × |V| ) (cid:1) in the network model.The number of transitions in δ (cid:48) is bounded by | δ | + O (cid:0)(cid:80) x ∈A ( |Q x | × |Q| × |A| ) (cid:1) ,which corresponds to O ( |A| × |V| ) in the network model. Example.
Algorithm 2 transforms the PDA in Fig. 3(b) into the PDA inFig. 3(c). For the protocol b , the algorithm computes the sub-automaton in-duced by the states V b , W b and K b . The distance P ( V b , W b ) = 1 is then com-puted. Thus, to bypass the sequence of transitions ( V b , (cid:104) b, a, a (cid:105) , W b ) ( W b , (cid:104) b, a, ∅(cid:105) , D a ),the transition ( V b , (cid:104) b , a, ∅(cid:105) , D a ) is added.Let L ( A N ) be the set of words accepted by A N , and let L ( A (cid:48) N ) be the set ofwords accepted by A (cid:48) N . Let f : Σ (cid:48) → Σ ∗ be a function s.t.: • if x i = a i ∈ A (cid:48) then f ( x i ) = aa . . . aa (cid:124) (cid:123)(cid:122) (cid:125) i occurrences • if x i = a i ∈ A (cid:48) then f ( x i ) = aa . . . aa (cid:124) (cid:123)(cid:122) (cid:125) i occurrences The domain of f is extended to (Σ (cid:48) ) ∗ : f : (Σ (cid:48) ) ∗ → Σ ∗ w (cid:48) = x i x j . . . x nk → f ( w (cid:48) ) = f ( x i ) f ( x j ) . . . f ( x nk )For simplicity, we consider that x and x are the same character. f ( L ( A (cid:48) N ))denotes the set of words accepted by A (cid:48) N transformed by f (i.e. f ( L ( A (cid:48) N )) = { f ( w (cid:48) ) s.t. w (cid:48) ∈ L ( A (cid:48) N ) } ).It is clear that f is not a bijection ( f ( x i x j ) = f ( x i + j )). So to operate thetransformation between L ( A N ) and L ( A (cid:48) N ), we define g : Σ ∗ → (Σ (cid:48) ) ∗ s.t. :for each w = xx . . . x (cid:124) (cid:123)(cid:122) (cid:125) i occurrences yy . . . y (cid:124) (cid:123)(cid:122) (cid:125) j occurrences . . . zz . . . z (cid:124) (cid:123)(cid:122) (cid:125) k occurrences ∈ Σ ∗ , g ( w ) = x i y j . . . z k .In other words, w (cid:48) = g ( w ) is the shortest word in (Σ (cid:48) ) ∗ s.t. f ( w (cid:48) ) = w .The following lemmas and proposition show that the set of words acceptedby the transformed automaton is ‘equivalent’ to the set of words accepted bythe original automaton. Equivalent in the meaning that, using f , each wordaccepted by the transformed automaton can be associated to a word acceptedby the original one. In addition, the transformed automaton has a new propri-ety: there is a linear relation between the length of an accepted word and theminimum number of pushes (and pops) involved to accept it. This proprietyallows to find the word requiring the minimum number of pushes accepted bythe original automaton. This is done by finding the shortest word accepted bythe transformed automaton. 13uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 Lemma 1. f ( L ( A (cid:48) N )) , the set of words accepted by A (cid:48) N and transformed by f ,is equal to L ( A N ) , the set of words accepted by A N . Proof.
We prove this by double inclusion:1. L ( A N ) ⊆ f ( L ( A (cid:48) N )) : ∀ w ∈ L ( A N ) , f ( w ) = w (remind that we considerthat x = x ). So f ( L ( A N )) = L ( A N ) (1). On the other hand, the con-struction of A (cid:48) N by algorithm 2 does not delete any character, transition,state or set of final states from A N . So L ( A N ) ⊆ L ( A (cid:48) N ). And thus f ( L ( A N )) ⊆ f ( L ( A (cid:48) N )) (2)By (1) and (2), L ( A N ) ⊆ f ( L ( A (cid:48) N )).2. L ( A N ) ⊇ f ( L ( A (cid:48) N )) : Let w (cid:48) = x i x j . . . x nl be a word in L ( A (cid:48) N ) and let t (cid:48) t (cid:48) . . . t (cid:48) n +1 be a sequence of transitions accepting w (cid:48) . For each transi-tion t (cid:48) m = ( U x m − , (cid:104) x m − k , α, β (cid:105) , W x m ) (1 < m < n ) in this sequence, s.t. t (cid:48) m ∈ δ (cid:48) \ δ , there is a sequence of k − A N (be-cause the creation of t (cid:48) m in A (cid:48) N requires the existence of such a sequencein A N ). This sequence begins from the state U x m − and is followed by atransition ( V x m − , (cid:104) x m − , α, β (cid:105) , W x m ). Thus, this sequence in A N matcheswith f ( x m − k ) And for each t (cid:48) m in A (cid:48) N , either t (cid:48) m ∈ δ so t (cid:48) m matches with x m +1 k (if k = 1), or t (cid:48) m ∈ δ (cid:48) \ δ and there is a sequence of transitions in A N which matches with f ( x m +1 k ) (if k > f ( w (cid:48) ) = f ( x i ) f ( x j ) . . . f ( x nl ), f ( w (cid:48) ) ∈ L ( A N ). Thus f ( L ( A (cid:48) N )) ⊆ L ( A N ). (cid:50) Let w (cid:48) be the shortest word accepted by A (cid:48) N , let N b A (cid:48) N push ( w (cid:48) ) be the minimumnumber of pushes in a sequence of transitions accepting w (cid:48) in A (cid:48) N , and let N b A (cid:48) N pop ( w (cid:48) ) be the minimum number of pops in a sequence of transitions accepting w (cid:48) in A (cid:48) N . Lemma 2.
The length of the shortest path (sequence of transitions) accepting w (cid:48) in A (cid:48) N is N b A (cid:48) N push ( w (cid:48) ) + N b A (cid:48) N pop ( w (cid:48) ) and N b A (cid:48) N pop ( w (cid:48) ) = N b A (cid:48) N push ( w (cid:48) ) + 1 . Proof.
First we prove that w (cid:48) cannot be in the form of . . . x mi x m +1 j . . . with x m = x m +1 . Let U x m be the state in which A (cid:48) N is before reading the character x mi . Let V x m +1 be the state in which A (cid:48) N is after reading x mi and before reading x m +1 j . And let W y be the state in which A (cid:48) N is after reading x m +1 j . If x m = x m +1 , then, by construction, there is a transition ( U x m , (cid:104) x mi + j , α, β (cid:105) , W y ) (where α, β is a pop of y or a push of x m if x m (cid:54) = y ). So, if x mi x m +1 j is replaced by x mi + j in w (cid:48) , the word obtained is shorter then w (cid:48) and is also accepted by A (cid:48) N .Thus, the shortest word accepted by A (cid:48) N is w (cid:48) = x i x j . . . x nk where x m (cid:54) = x m +1 for (1 ≤ m < n ).By construction of A (cid:48) N , for each character x mi in w (cid:48) , there is a push transition( U x m , (cid:104) x mi , α, x m α (cid:105) , W y ) if x mi ∈ A (cid:48) or a transition ( U x m , (cid:104) x mi , y, ∅(cid:105) , W y ) if x mi ∈A (cid:48) . So all transitions in the shortest sequence that accepts w (cid:48) are pops orpushes, except the first transition from the initial state ( S A , (cid:104) (cid:15), Z , Z (cid:105) , U x )and the final pop ( V x n , (cid:104) x nk , Z , ∅(cid:105) , D A ). The number of other pops is equal to14uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009the number of pushes (in order to have Z at the top of the stack before thefinal transition). (cid:50) Now let w be a word accepted by A N , let N b A N push ( w ) be the minimum numberof pushes in a sequence of transitions accepting w in A N , and let N b A N pop ( w ) bethe minimum number of pops in a sequence of transitions accepting w in A N . Lemma 3.
For each w ∈ L ( A N ) : • N b A N pop ( w ) = N b A (cid:48) N pop ( g ( w )) • N b A N push ( w ) = N b A (cid:48) N push ( g ( w )) Proof.
Let t t . . . t n be the sequence of transitions accepting w in A N withminimum number of pushes and pops. For each sequence t i t i +1 . . . t j of passivetransitions, followed by a push or a pop transition, there is a transition withthe same push or pop and the same input character indexed by j − i + 1. So g ( w ) ∈ L ( A (cid:48) N ).Let t (cid:48) t (cid:48) . . . t (cid:48) n (cid:48) be the sequence of transitions with minimum pushes and popsaccepting g ( w ) in A (cid:48) N . It is clear that f ( g ( w )) = w . So if there is a sequence t (cid:48)(cid:48) t (cid:48)(cid:48) . . . t (cid:48)(cid:48) n (cid:48) that accepts g ( w ) with less pops and pushes than t (cid:48) t (cid:48) . . . t (cid:48) n (cid:48) , theneach t (cid:48)(cid:48) i ∈ δ (cid:48) \ δ can be replaced by a sequence of passive transitions followed bya pop or a push in A N . And theses sequences accept f ( g ( w )) (which is w ) withless pops and pushes than in the sequence t t . . . t n , which contradicts the factthat it minimizes the number of pops and pushes to accept w . (cid:50) Proposition 2.
The word accepted by A N which minimizes the number ofpushes is f ( w (cid:48) ) , where w (cid:48) is the shortest word (i.e., with minimum numberof characters) accepted by A (cid:48) N . Proof.
By lemma 2, the shortest word accepted by A (cid:48) N minimizes the numberof pushes in A (cid:48) N (since the number of pushes grows linearly as a function of thelength of the word). Let w (cid:48) be this word.Suppose that there is a word w accepted by A N such that N b A N push ( w ) < N b A (cid:48) N push ( w (cid:48) ).By lemma 3, N b A (cid:48) N push ( g ( w )) = N b A N push ( w ), which leads to N b A (cid:48) N push ( g ( w )) U, V ∈ Q and X ∈ Γ (resp. Q (cid:48) and Γ (cid:48) ). The demonstration of the correctness of this trans-formation is also in [13]. Algorithm 3 Converting a PDA to a CFGInput: PDA A N = ( Q , Σ , Γ , δ, S A , Z , { D A } ) (resp. Transformed PDA A (cid:48) N =( Q (cid:48) , Σ (cid:48) , Γ (cid:48) , δ (cid:48) , S A , Z , { D A } ))Output: a CFG G N = ( N , Σ , [ S G ] , P ) (resp. ( N , Σ (cid:48) , [ S G ] , P ))(1) Create the nonterminal [ S G ](2) For each state U x ∈ Q (2.1) create a nonterminal [ S A Z U x ] and a production [ S G ] → [ S A Z U x ](3) For each transition ( U x , (cid:104) x, α, β (cid:105) , V y )(3.1) If β = ∅ (pop), create a nonterminal [ U x αV y ] and a production[ U x αV y ] → x (3.2) If β = α (passive transition), create for each state W ∈ Q (resp. Q (cid:48) )(3.2.1) Nonterminals [ U x αW ] and [ V y αW ](3.2.2) A production [ U x αW ] → x [ V y αW ](3.3) If β = xα, x ∈ Γ (push), create for each states ( W, W (cid:48) ) ∈ Q (resp. Q (cid:48) ) (3.3.1) Nonterminals [ U x αW (cid:48) ], [ V y αW ] and [ W αW (cid:48) ](3.3.2) A production [ U x αW (cid:48) ] → x [ V y xW ][ W αW (cid:48) ] Complexity. The number of production rules in G N is bounded by 1 + |Q| +( | δ | × |Q| ) (resp. 1 + |Q (cid:48) | + ( | δ (cid:48) | × |Q (cid:48) | ). As all the nonterminals (except [ S G ])are in the form [ U x αV y ] with U x , V y ∈ Q and α ∈ Γ, the number of non terminalsis bounded by O ( |A| × |Q| ) (resp. O ( |A| × |Q| )). The worst case complexityof algorithm 3 is in O ( | δ | × |Q| ) (resp. O ( | δ (cid:48) | × |Q (cid:48) | )). W.r.t. the definitionof the network, the upper bound is in O ( |A| ×|V| ×| E | ) (resp. O ( |A| ×|V| )). Example. This method transforms the PDA in Fig. 3(c) into a CFG. Fig-ure 3(d) is a subset of production rules of the obtained CFG. This subset allowsgenerating the shortest trace of a feasible path in the network in Fig. 3(a). Forinstance, the transition ( V b , (cid:104) b , a, ∅(cid:105) , D a ) gives the production rule [ V b aD a ] → b . The transition ( U a , (cid:104) a, Z , aZ (cid:105) , V b ) gives all the production rules [ U a Z X (cid:48) ] → a [ V b aX ][ XZ X (cid:48) ] where X, X (cid:48) ∈ Q (cid:48) , including the production [ U a Z D A ] → a [ V b aD a ][ D a Z D A ] . Remark. There are two mechanisms of acceptance defined for PDAs: an inputword can be accepted either by empty stack (i.e., if the stack is empty afterreading the word) or by final state (i.e., if a final state is reached after reading the16uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009word - even if the stack is not empty). Algorithm 3 takes as input an automatonwhich accepts words by empty stack. A N and A (cid:48) N accept words by empty stackand by final state, because the only transitions that empty the stack are thosethat reach the final state (the transitions in the form ( D x , (cid:104) x, Z , ∅(cid:105) , D A ) , x ∈ In ( D )). Thus, Algorithm 3 performs correctly with A N or A (cid:48) N as input. To find the shortest word generated by G N , a function (cid:96) associates eachnonterminal to the length of the shortest word that it generates.More formally, (cid:96) : {N ∪ Σ ∪ { (cid:15) }} ∗ or {N ∪ Σ (cid:48) ∪ { (cid:15) }} ∗ → N ∪ {∞} s.t.: • if w = (cid:15) then (cid:96) ( w ) = 0, • if w ∈ Σ or Σ (cid:48) then (cid:96) ( w ) = 1, • if w = α . . . α n (with α i ∈ {N ∪ Σ ∪ { (cid:15) }} or {N ∪ Σ (cid:48) ∪ { (cid:15) }} ) then (cid:96) ( w ) = (cid:80) ni =1 (cid:96) ( α i ).Algorithm 4 computes the value of (cid:96) ([ X ]) for each [ X ] ∈ N . Algorithm 4 Compute the values (cid:96) ([ X ]) for each nonterminal [ X ] ∈ N Input: G N = ( N , Σ , [ S G ] , P ) or ( N , Σ (cid:48) , [ S G ] , P )Output: (cid:96) ([ X ]) for each nonterminal [ X ](1) Initialize each (cid:96) ([ X ]) to ∞ (2) While there is at least one (cid:96) ([ X ]) updated at the previous iteration do(2.1) For each production rule [ X ] → α . . . α n in P (2.1.1) (cid:96) ([ X ]) ← min { (cid:96) ([ X ]) , (cid:80) ni =1 (cid:96) ( α i ) } Proposition 3. Algorithm 4 terminates at worst after |N | iterations, and each (cid:96) ([ X ]) ([ X ] ∈ N ) obtained is the length (number of characters) of the shortestword produced by [ X ] . Proof. We prove that at each iteration (except the last one), there is a leastone nonterminal [ X ] s.t. (cid:96) ([ X ]) is updated with the length of the shortest wordthat [ X ] produces.Thus, the update of all (cid:96) ([ X ]) with their correct values is doneat worst in |N | iterations. We proceed by induction on the number of iterations: Basis: There is no (cid:15) -production in G N , and there is at least one production inthe form [ X ] → x where [ X ] ∈ N and x ∈ Σ (resp. Σ (cid:48) ) (see algorithm 3 for theconstruction of G N ). For each [ X ] ∈ N s.t. { [ X ] → x } ∈ P , (cid:96) ([ X ]) = 1. Andalgorithm 4 assigns these values to each (cid:96) ([ X ]) at the first iteration. Induction: Suppose that at iteration n , there are at least n (cid:48) ( n ≤ n (cid:48) < |N | )nonterminals [ X ] s.t. the algorithm has assigned the correct value to (cid:96) ([ X ]). Sothere are |N | − n (cid:48) nonterminals which have not the correct (cid:96) -value yet.17uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 • Either there is a nonterminal [ Y ] s.t. (cid:96) ([ Y ]) has not already the correctvalue (i.e., it can already be updated), but for all productions [ Y ] → γ | . . . | γ m (each [ Y ] → γ i is a production) all nonterminals in γ , . . . , γ m have their correct (cid:96) -values. And thus, (cid:96) ([ Y ]) will be updated with thecorrect value at the end of the following iteration. • Or, for each nonterminal [ Y ] with a wrong (cid:96) -value, there is at least anonterminal in each of its productions [ Y ] → γ | . . . | γ m which has not itscorrect (cid:96) -value yet. – Either each γ i contains a nonterminal which generates no word. Thus,[ Y ] generates no word and the value of (cid:96) ([ Y ]) = ∞ is correct. – Or all nonterminals in each γ i generate a word. However, in thederivation of the shortest word generated by any nonterminal, nononterminal is used twice or more (otherwise a shorter word can begenerated by using this nonterminal once). Thus, among all nonter-minals with a wrong (cid:96) -value, there is one which does not use othersto generate its shortest word. So its (cid:96) -value is already correct or itwill be updated to the correct value at the following iteration. (cid:50) Complexity. As there is at worst |N | iteration of the while loop, the complexityof algorithm 4 is in O ( |N | × |P| ) which is O ( |A| × | V | × | E | ) (resp. O ( |A| ×| V | )) in the network modelThere are several algorithms which allow the generation of a uniform randomword of some length from a CFG [12, 9, 18], or, more recently, a non-uniformrandom generation of a word according to some targeted distribution [5, 10].For instance, the boustrophedonic and the sequential algorithms described in[9] generate a random labeled combinatorial object of some length from anydecomposable structure (including CFGs). The boustrophedonic algorithm isin O ( n log n ) (where n is the length of the object) and the sequential algo-rithm is in O ( n ) but may have a better average complexity. Both algorithmsuse a precomputed table of linear size. This table can be computed in O ( n ).These algorithms require an unambiguous CFG, and the CFG computed byalgorithm 3 can be inherently ambiguous depending on the input network (asseveral feasible paths can use the same sequence of protocols and thus have thesame trace T C ). However, the unambiguity requirement is only for the ran-domness of the generation. Recall that our goal is to generate the trace of theshortest feasible path. Thus, we do not take into consideration the random-ness and the distribution over the set of shortest traces. In order to generatethe shortest word in L ( G N ), the boustrophedonic algorithm can take G N and (cid:96) ([ S G ]) as input (recall that (cid:96) ([ S G ]) is the length of the shortest word generatedby G N ). Thus, the generation of the shortest word w (resp. w (cid:48) ) would have beenin O ( | w | ) (resp. O ( | w (cid:48) | )), where | w | denotes the length (number of characters)of w . This complexity includes the precomputation of the table. However, thiscomplexity hides factors depending of the size of the CFG, the construction ofthe precomputed table requires at least one pass over all the production rules.18uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009Actually, as the (cid:96) -values are already computed, the generation can simply bedone in linear time in the length of the shortest word. The standard algorithm 5takes as input the CFG and the (cid:96) -values. Each nonterminal is replaced by theleft part with minimal (cid:96) -value among its productions. Algorithm 5 Computing the shortest word generated by G N Input: G N = ( N , Σ (cid:48) , [ S G ] , P ) and all (cid:96) -valuesOutput: w , the shortest word generated by G N { [ S G ] → γ | γ | . . . | γ m are all production rules with [ S G ] as left part } (1) w ← arg min { (cid:96) ( γ ) , . . . , (cid:96) ( γ m ) } (2) While there is at least one nonterminal in w (2 . 1) For each nonterminal [ X ] in w do(2 . . 1) Replace [ X ] in w by arg min { (cid:96) ( γ (cid:48) ) , . . . , (cid:96) ( γ (cid:48) m (cid:48) ) }{ [ X ] → γ (cid:48) | . . . | γ (cid:48) m (cid:48) are all production rules with [ X ] as left part } Complexity. Since there is no derivation of the form [ X ] → (cid:15) in G N (seealgorithm 3), all branches in the derivation tree end with a character from Σ(resp. Σ (cid:48) ). The length of each branch is at worst |N | (as a nonterminal does notappears twice in the same branch, otherwise a shorter word could be derivatedby using this nonterminal once). Thus, the number of derivations and the com-plexity of algorithm 5 are bounded by O ( |N | × | w | ) (resp. O ( |N | × | w (cid:48) | )), whichcorresponds to O ( |A| × |V| × | w | ) (resp. O ( |A| × |V| × | w (cid:48) | )) in the networkmodel. Example. Algorithm 4 gives (cid:96) ([ S G ]) = 3. Algorithm 5 computes the shortestword using the production rules in Fig. 3(d). The derivation is:[ S G ] (1) (cid:96) [ S A Z D A ] (2) (cid:96) [ U a Z D A ] (3) (cid:96) a [ V b aD a ][ D a Z D A ] (4) (cid:96) ab [ D a Z D A ] (5) (cid:96) ab a Thus, the shortest word accepted by the transformed PDA is ab a . And theshortest trace of a feasible path is f ( ab a ) = abba . If the goal is to minimize the number of nodes in the path, algorithm 6 takesas input the shortest word w accepted by A N . Otherwise, as w (cid:48) is the shortestword accepted by A (cid:48) N and generated by G N , according to proposition 2, f ( w (cid:48) )is the word which minimizes the number of pops and pushes in A N . In such acase it is the trace T C of the shortest feasible path C in the network N . It ispossible that several paths match with the trace T C = w (resp. f ( w (cid:48) )). In sucha case, a load-balancing policy can choose a path.Algorithm 6 is a dynamic programming algorithm that computes C . It startsat the node S and takes at each step all the links in E which match with thecurrent character in T C . Let T C = x x . . . x n ( x i ∈ A ∪ A ). At each step i , thealgorithm starts from each node U in N odes [ i ] and adds to Links [ i ] all links( U, V ) which match with x i . It also adds each V in N odes [ i +1]. When reaching D , it backtracks to S and selects the links from D to S .19uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 Algorithm 6 Find the shortest pathInput: Network N and T C Output: Shortest path C (1) N odes [1] ← S ; i ← D is not reached do(2.1) for each U ∈ N odes [ i ] and each V ∈ V s.t. ( U, V ) ∈ E do(2.1.1) If x i ∈ A , x i ∈ Out ( U ), x i ∈ In ( V ) and ( x i − , x i ) ∈ P ( U )(2.1.1.1) Add ( U, V ) to Links [ i ] and V to N odes [ i + 1](2.1.2) If x i ∈ A , x i ∈ Out ( U ), x i ∈ In ( V ) and ( x i , x i − ) ∈ P ( U )(2.1.2.1) Add ( U, V ) to Links [ i ] and V to N odes [ i + 1](2.2) i + +(3) Backtrack from D to S by adding each covered link in the backtrackingto C . Algorithm Upper-Bound ComplexityMinimizing hops Minimizing enc./dec.Algo. 1: Network to PDA O ( |A| × | E | )Algo. 2: Transform PDA / O (max( |A| × | E | , |A| × |V| )Algo. 3: PDA to CFG O ( |A| × |V| × | E | ) O ( |A| × |V| )Algo. 4: Shortest word length O ( |A| × |V| × | E | ) O ( |A| × |V| )Algo. 5: Shortest word O ( |A| × |V| × | w | ) O ( |A| × |V| × | w (cid:48) | )Algo. 6: Shortest path O ( | T C | × |V| × | E | )Table 1: Algorithms and their complexities Complexity. The while loop stops exactly after T C steps, because it is surethat there is a feasible path of length | T C | if T C is accepted by the automaton A N . At each step, all links and nodes are checked in the worst case. Thus,algorithm 6 is in O ( | T C | × |V| × | E | ) in the worst case. Example. From the shortest trace abba , algorithm 6 computes the only feasiblepath in the network on Fig. 3(a), which is S, a, U, b, V, b, W, a, D . 6. Conclusion The problem of path computation in a multi-layer network has been studiedin the field of intra-domain path computation but is less addressed in the inter-domain field with consideration of the Pseudo-Wire architecture. There was nopolynomial solution to this problem and the models used were not expressiveenough to capture the encapsulation/decapsulation capabilities described in thePseudo-Wire architecture.In this paper, we provide algorithms that compute the shortest path ina multi-layer multi-domain network, minimizing the number of hops or thenumber of encapsulations and decapsulations. The presented algorithms involveAutomata and Language Theory methods. A Push-Down Automaton models20uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009the multi-layer multi-domain network. It is then transformed in order to bypasspassive transitions and converted into a Context-Free Grammar. The grammargenerates the shortest protocol sequence, which allows to compute the pathmatching this sequence.The different algorithms of our methodology have polynomial upper-boundcomplexity as summarized by Table 1. Compared to the preliminary versionof this work, the proofs of correctness of the algorithms are detailed and thecomplexity analysis is significantly refined (the highest algorithm complexity isin O ( |A| × |V| ) instead of O ( |A| × |V| × | E | )).In order to figure out the whole problem of end-to-end service delivery, weplan to extend our solution to support end-to-end Quality of Service constraintsand model all technology constraints on the different layers (conversion or “ map-ping ” of protocols). As a future work, we also plan to investigate which part ofour algorithms can be distributed (e.g., Can the domains publish their encap-sulation/decapsulation capabilities without disclosing their internal topology?)and how such a solution can be established on today’s architectures. Acknowledgment The first author would like to thank Kaveh Ghasemloo for his help aboutAlgorithm 4. This work is partially supported by the ETICS-project, fundedby the European Commission. Grant agreement no.: FP7-248567 ContractNumber: INFSO-ICT-248567. Appendix A. List of notations In order to facilitate the paper reading, Table A.2 summarizes the symbolsused in the paper. References [1] M. Bocci and S. Bryant. RFC5659 - An Architecture for Multi-SegmentPseudowire Emulation Edge-to-Edge, 2009.[2] S. Bryant and P. Pate. RFC3985 - Pseudo Wire Emulation Edge-to-Edge(PWE3) Architecture, 2005.[3] I. Chlamtac, A. Farag´o, and T. Zhang. Lightpath (Wavelength) Routingin Large WDM Networks. IEEE Journal on Selected Areas in Communi-cations , 14(5):909–913, 1996.[4] H. Cho, J. Ryoo, and D. King. Stitching dynamicallyand statically provisioned segments to construct end-to-end multi-segment pseudowires. , 2011.21uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009 (a) Network(b) Corresponding PDA(c) Transformed PDA(d) Subset of G N which generates T C Figure 3: Example Symbols and their signification Symbols and their signification V : The set of nodes of the network E : The set of links of the network G = ( V , E ): The graph modeling thenetwork topology S : The source node D : The destination node A : The alphabet (set of protocol) A : { a s.t. a ∈ A} P(U): The set of adaptation functions ofnode U ED : The set of all possible encapsula-tions and passive functions ED : The set of all possible decapsula-tions In ( U ): The set of protocols that node U can receive Out ( U ): The set of protocols that node U can send T ( U ): The set of protocols that can pas-sively cross node U ( a, a ): Passive function( a, b ): Encapsulation of protocol a in b ( a, b ): Decapsulation of protocol a from bT C : The sequence of protocols used overthe path C (trace of C ) H C : Sequence of adaptation functionsinvolved in path C (transition sequenceof C ) M C : The well-parenthesized sequenceof C A N : Automaton corresponding to net-work N Q : The set of states of A N Σ: The input alphabet of A N Γ: The stack alphabet of A N δ : The set of transitions of A N S A : Initial state of A N Z : Initial stack symbol D A : Final state of A N ( U x , (cid:104) x, α, β (cid:105) , V y ): A transition betweenstates U x and V y , where x is read, α ispopped from the stack and β is pushedon the stack Q a : Sub-automaton indexed by a A (cid:48) N : Transformed PDA L ( A N ): Language accepted by A N N b A N push ( w ): Minimum number of pushesin a sequence of transitions acceptingthe word w in A N G N : Context-free grammar correspond-ing to network N N : The set of nonterminals of G N [ S G ]: Initial nonterminal (axiom) of G N P : The set of production rules of G N (cid:96) ([ X ]): Length of the shortest word gen-erated by nonterminal [ X ] Table A.2: List of symbols used in the paper. Theoretical Computer Science , 411(40-42):3527–3552, 2010.[6] F. Dijkstra, B. Andree, K. Koymans, J. van der Ham, P. Grosso, andC. de Laat. A multi-layer network model based on ITU-T G.805. Comput.Netw. , 2008.[7] F. Dijkstra, J. Van der Ham, P. Grosso, and C. de Laat. A path findingimplementation for multi-layer networks. Future Generation Comp. Syst. ,25(2):142–146, 2009.[8] A. Farrel, JP. Vasseur, and J. Ash. RFC4655 - A Path Computation Ele-ment (PCE)-Based Architecture, 2006.[9] Ph. Flajolet, P. Zimmermann, and B. Van Cutsem. A calculus for the ran-dom generation of labelled combinatorial structures. Theoretical ComputerScience , 1994.[10] D. Gardy and Y. Ponty. Weighted random generation of context-free lan-guages: Analysis of collisions in random urn occupancy models. GASCom ,2010.[11] S. Gong and B. Jabbari. Optimal and Efficient End-to-End Path Compu-tation in Multi-Layer Networks. In ICC , pages 5767–5771, 2008.[12] T. Hickey and J. Cohen. Uniform random generation of strings in a context-free language. SIAM J. Comput. , 12(4):645–655, 1983.[13] J. E. Hopcroft, R. Motwani, and J. D. Ullman. From PDA’s to Grammars.In Introduction to Automata Theory, Languages, and Computation , chap-ter 6.3.2, pages 247–251. Addison-Wesley Longman Publishing Co., Inc.,Boston, MA, USA, 2006.[14] F. A. Kuipers and F. Dijkstra. Path selection in multi-layer networks. Computer Communications , 2009.[15] M. L. Lamali, H. Pouyllau, and D. Barth. Path computation in Multi-Layermulti-domain networks. In IFIP/TC6 Networking 2012 (NETWORKING2012) , Prague, Czech Republic, May 2012.[16] M.L. Lamali, H. Pouyllau, and D. Barth. End-to-End Quality of Servicein Pseudo-Wire Networks. In ACM CoNEXT Student Workshop , 2011.[17] Jens Liebehenschel. Lexicographical Generation of a Generalized DyckLanguage. SIAM J. Comput. , 2003.[18] H. G. Mairson. Generating Words in a Context-Free Language Uniformlyat Random. Inf. Process. Lett. , 49(2):95–99, 1994.24uthor’s personal copy Published version doi:10.1016/j.comcom.2012.11.009[19] L. Martini, E. Rosen, N. El-Aawar, and G. Heron. RFC4448 - Encapsula-tion Methods for Transport of Ethernet over MPLS Networks, 2008.[20] K. Shiomoto, D. Papadimitriou, JL. Le Roux, M. Vigoureux, and D. Brun-gard. RFC5212 - Requirements for GMPLS-based multi-region and multi-layer networks (MRN/MLN), 2008.[21] Y(J). Stein, R. Shashoua, R. Insler, and M. Anavi. RFC5087 - Time Divi-sion Multiplexing over IP (TDMoIP), 2007.[22] W. Yao and B. Ramamurthy. A Link Bundled Auxiliary Graph Model forConstrained Dynamic Traffic Grooming in WDM Mesh Networks. IEEEJournal on Selected Areas in Communications , 23(8):1542–1555, 2005.[23] H. Zhu, H. Zang, K. Zhu, and B. Mukherjee. A novel generic graph modelfor traffic grooming in heterogeneous WDM mesh networks.