11
Information Processing Letters 88 (2003) 121–131 www.elsevier.com/locate/ipl Determination of the topology of a directed network Darin Goldstein Computer Science Department, California State University, Long Beach, CA 90840, USA Received 18 October 2002; received in revised form 22 March 2003 Communicated by M. Yamashita Abstract We consider strongly-connected, directed networks of identical synchronous, finite-state processors with in- and out- degree uniformly bounded by a network constant. Via a straightforward extension of Ostrovsky and Wilkerson’s Backwards Communication Algorithm [Proc. 14th Annual Symp. on Principles of Distributed Computing, 1995], we exhibit a protocol which solves the Global Topology Determination Problem, the problem of having a root processor map the global topology of a network of unknown size and topology, with running time O(ND) where N represents the number of processors and D represents the diameter of the network. A simple counting argument suffices to show that the Global Topology Determination Problem has time-complexity (N log N) which makes the protocol presented asymptotically time-optimal for many large networks. 2003 Elsevier B.V. All rights reserved. Keywords: Data structures; Global Topology Determination Problem; Time complexity; Directed networks 1. Introduction 1.1. The network model We consider strongly-connected directed networks of identical synchronous finite-state automata with in- and out-degree bounded by a constant. These automata are meant to model very small, very fast processors. The network itself has unknown topology and poten- tially unbounded size N . Throughout this paper, we use the term “-port” to refer to one of a number of uni- directional conduits through which constant-size mes- sages may pass from one processor to another. An in- port to a processor will allow messages to flow uni- directionally in towards the processor. Out-port is de- E-mail address: [email protected] (D. Goldstein). fined similarly. We assume throughout that the num- ber of in-ports and out-ports for each processor is uni- formly bounded above by a network constant δ 2. The network is formed by connecting out-ports from processors to the in-ports of other processors with wires. Not all in-ports or out-ports of a given proces- sor need necessarily be connected to other processors; however, any given processor must have at least one connected in-port and out-port. Note that even though the communication links are unidirectional, a pair of processors is allowed to be connected with two com- munication links, one in either direction, simulating a bidirectional link. We assume that each processor in the network is initially in a special “quiescent” state, in which, at each time-step, the processor sends a “blank” character through all of its out-ports. A processor remains in the 0020-0190/$ – see front matter 2003 Elsevier B.V. All rights reserved. doi:10.1016/S0020-0190(03)00362-4

Determination of the topology of a directed network

Embed Size (px)

Citation preview

Page 1: Determination of the topology of a directed network

l

out-ckwardsotocolopologydminationlarge

m-

Information Processing Letters 88 (2003) 121–131

www.elsevier.com/locate/ip

Determination of the topology of a directed network

Darin Goldstein

Computer Science Department, California State University, Long Beach, CA 90840, USA

Received 18 October 2002; received in revised form 22 March 2003

Communicated by M. Yamashita

Abstract

We consider strongly-connected,directed networks of identical synchronous, finite-state processors with in- anddegree uniformly bounded by a network constant. Via a straightforward extension of Ostrovsky and Wilkerson’s BaCommunication Algorithm [Proc. 14th Annual Symp. on Principles of Distributed Computing, 1995], we exhibit a prwhich solves the Global Topology Determination Problem, the problem of having a root processor map the global tof a network of unknown size and topology, with running time O(ND) whereN represents the number of processors anD

represents the diameter of the network. A simple counting argument suffices to show that the Global Topology DeterProblem has time-complexity�(N logN) which makes the protocol presented asymptotically time-optimal for manynetworks. 2003 Elsevier B.V. All rights reserved.

Keywords:Data structures; Global Topology Determination Problem; Time complexity; Directed networks

1. Introduction fined similarly. We assume throughout that the nu

in-mators.n-

eni-es-nni-

ber of in-ports and out-ports for each processor is uni-

miths-sors;one

ughofm-a

k ischcterthe

erved

1.1. The network model

We consider strongly-connecteddirectednetworksof identical synchronous finite-state automata withand out-degree bounded by a constant. These autoare meant to model very small, very fast processThe network itself has unknown topology and potetially unbounded sizeN . Throughout this paper, wuse the term “-port” to refer to one of a number of udirectional conduits through which constant-size msages may pass from one processor to another. Ain-port to a processor will allow messages to flow udirectionally in towards the processor.Out-port is de-

E-mail address:[email protected] (D. Goldstein).

0020-0190/$ – see front matter 2003 Elsevier B.V. All rights resdoi:10.1016/S0020-0190(03)00362-4

a

formly bounded above by a network constantδ � 2.The network is formed by connecting out-ports froprocessors to the in-ports of other processors wwires. Not all in-ports or out-ports of a given procesor need necessarily be connected to other proceshowever, any given processor must have at leastconnected in-port and out-port. Note that even thothe communication links are unidirectional, a pairprocessors is allowed to be connected with two comunication links, one in either direction, simulatingbidirectional link.

We assume that each processor in the networinitially in a special “quiescent” state, in which, at eatime-step, the processor sends a “blank” charathrough all of its out-ports. A processor remains in

.

Page 2: Determination of the topology of a directed network

122 D. Goldstein / Information Processing Letters 88 (2003) 121–131

quiescent state until a non-blank character is receivedby one of its in-ports.

be-uta-balr:

essoad-

icalny

ast.rkesiondedingylt.)

ofssosorsorytheth a

ginsidetot.inalfullyatetalndis

ethe

ed

elof

small and fast processors with only the capacity forreliable unidirectional communication. More specifi-

erses-ainen-ro-eledateem-er,tessorakecesuni-them-o-re-m-

ot’sin-to

ngim-ilityareof

on-

ral(Thently-,t beut-om-thisport

x-t-

The network has a global clock, the pulsestween which each processor performs its comptions. Processors synchronously, within a single gloclock pulse, perform the following actions in orderead in the inputs from each of their in-ports, proctheir individual state changes, and prepare and brcast their outputs.

The reason for modeling the processors by identfinite-state automata is simple. In practice, manetwork protocols are expected to run extremely f(One particular reason for this is that the netwotopology or size might change if the protocol taktoo long thereby potentially rendering the computatobsolete. Obviously, if a processor is randomly ador removed from the topology of the networkthe middle of the computation, a global topolodetermination is likely to produce an incorrect resuCommonly, a memory access can take ordersmagnitude longer than a simple state-change procecalculation. It is therefore assumed that the procesinvolved will not have time to access a large memcache. The current technological trend is to mergememory functions that one generally associates wicomputing machine into the processor itself.

The protocol described below is presumed to bewhen a certain processor is signaled by some outsource. We call this processor theroot, and assume thaevery processor knows whether or not it is the roA protocol ends when the root enters a special termstate indicating that the computation has successcompleted. In our computational model, we calculthe time-complexity of a protocol in terms of the tonumber of global time steps between initiation atermination. Of course, the aim is to minimize thtime-complexity.

Definition 1.1. Throughout this paper, we will usN to represent the total number of processors innetwork.D will represent the diameter of the directnetwork.

1.2. The Global Topology Determination Problem

1.2.1. Statement of the problemAs previously mentioned, our computational mod

is designed to realistically simulate a large network

r

cally, we have a large network of powerful computeach equipped with a very fast communication procsor (a communication device separate from the mprocessor of the computer which is presumablygaged in tasks other than simple communication ptocols). These communication processors are modby the finite-state automata. (We think of finite-stmachines as having a small/constant amount of mory which allows them to work faster than a largmore complex machine.) One such computer initiathe protocol by nudging its communication procesout of quiescence thereby forcing the device to ton the role of the root. The protocol then commenvia messages passing between the various commcation processors. At each step of the protocol,root is piping its computational transcript to the coputer to which it is attached. By the time the prtocol has completed execution (i.e., the root hasentered quiescence after informing its master coputer that the algorithm has completed), the rocomputer has enough information in the form ofput symbols read from its communication devicereconstruct the global topology of the network.

One point should be clarified: When consideriexplicit protocols on finite-state processors, anportant characteristic of the processors is the abto recognize whether their in-ports and out-portsconnected to other processors or not. The abilitya processor to recognize whether its in-ports are cnected to other processors is calledin-port awareness.A similar definition applies toout-port awareness.When dealing with practical applications it is natuto assume that processors have in-port awareness.quiescent (resting) state of a processor is to constasend out the blank characterb. If a processor is receiving ∅ (nothing) and notb through one of its in-portsthe processor knows immediately that there cannoa processor connected to that in-port.) However, oport awareness is not necessarily a given in some cmunications systems. We will assume throughoutpaper that processors have both in-port and out-awareness as did Ostrovsky and Wilkerson in [7].

1.2.2. Previous researchMapping the global network topology is an e

tremely important primitive utilized for message rou

Page 3: Determination of the topology of a directed network

D. Goldstein / Information Processing Letters 88 (2003) 121–131 123

ing as well as investigated for its intrinsic theoreti-cal interest. The literature on the subject of message

oster-ro-in

icaletbi-ndmsse-r-ndostof

et-to-ibli-

d allll-es-our

sultsanyghtofis

theas

sy-et-anne-s-

uni-orsl a-

kyofis

2. Data structures

e ofis

ed”is isughutsbal

wehichd-1in,

, ak.t aed-3

iblebeoneThetion

thewd

7].

nse:theof

th-wellort,at aen

thea

theen

routing and topology mapping is immense. The mobvious example of practical network topology detmination is Internet mapping. Internet mapping ptocols are not in short supply. Mainwaring et al.[5], for example, present and prove the theoretcorrectness of a protocol for mapping the Myrinsystem-area network at U.C. Berkeley. More amtiously, Govindan and Tangmunarunkit [4] present adiscuss a program called Mercator which perfor“informed random address probing”, a heuristic uful for mapping the entire Internet topology. And pehaps most impressively, in [1], Cheswick, Burch, aBranigan actually map the Internet topology almentirely. (In fact, they even perform an analysisthe NATO bombing campaign on Yugoslavia’s nwork connectivity.) Numerous other mapping procols and results can be found in these respective bographies.

Of course, the Internet is commonly considerebidirectional network with a fairly predictable overatopology (from a theoretician’s point of view). We wifocus ondirectednetworks of totally unknown topology and potentially unbounded size, and the procsors are assumed to be finite-state. The fact thatnetwork assumptions are so general make our reapplicable to other, more specific networks (e.g.,of the above references). However, our solution minot be the most efficient from a practical pointview for these other specific network types; thisespecially true if one has the foreknowledge thatnetwork in question has particular properties suchbidirectionality, greater processor memory, or an eato-map hypercube topology. On the other hand, nworks of the more general kind occur more often thone might think (e.g., GPS satellites, encrypted oway radio military networks, bidirectional networkwith in-port or out-port shutdown failures at individual processors, etc.). Network restrictions such asdirectional communication and finite-state processmake outlining a general topology mapping protoconontrivial exercise. Luckily, Even, Litman, and Winkler’s “snake” data structure [2] (used in Ostrovsand Wilkerson’s BCA in [7] and the equivalence proin [3] and modified for use in the protocol below)virtually tailor-made for the purpose.

2.1. Speed

The protocols about to be presented make usseveral computational constructs, each of whichassigned a certain characteristic “speed”. (The “speconcept can be referenced as far back as [6].) Thnot to say that certain messages move faster throthe network than others. All computations and outpare strictly synchronous with respect to the glonetwork clock.

In the protocol that follows, the speeds thatutilize are speed-1 and speed-3. The method by wwe implement a speed is as follows: A speeconstruct will enter a processor. It will then remathere for 3 global clock ticks. At the third clock tickit will proceed along its designated path. Similarlyspeed-3 construct will wait only 1 global clock ticThus, in reality, the implementation specifies thaspeed-1 construct moves 3 times slower than a speconstruct.

2.2. Tokens

Tokens are the simplest data structure posson networks of finite-state machine. They shouldthought of as markers that can be passed fromprocessor to another via the edges of the network.token concept has been in use since the first soluto the Firing Squad Synchronization Problem forbidirectional line [6]. The definitions we give beloof “breadth-first” and “loop” tokens were first outlinein [3] though the behaviors were also utilized in [2,

We employ two main varieties of tokens.Breadth-first tokens can be thought of as moving withia “breadth-first-search tree” in the following senWe arrange it so that each relevant processor innetwork has a “parent” marker associated with oneits in-ports. (The method by which various breadfirst-search trees are constructed by snakes, asas how each processor designates its “parent” in-pis discussed in Section 2.3.2.) We then declare thbreadth-first token will only be accepted by a givprocessor when either (a) the processor createstoken, in which case the processor will not haveparent in-port, or (b) the token comes throughprocessor’s parent in-port. If a breadth-first tok

Page 4: Determination of the topology of a directed network

124 D. Goldstein / Information Processing Letters 88 (2003) 121–131

is received through a non-parent in-port or by aquiescent processor, it is ignored. Breadth-first tokens

firstas

rchat

thate.

l

pe-t re-ces-as-anybed

aeykes

elyg

erthekeofionsor.y

m-ors,odeoteath

all

snakesare used to mark encoded paths. Our protocolrequires two kinds of each of the two snake types;

,red ateshent-G-what

nwsey

pe,go

s.

es-ne-akeoteon-tateber

ra-

e at-th-

ter-dyi-

akeonles

thees-t of

are passed out of every out-port; thus, breadth-tokens multiply in number as time goes on (as longthey stay within the confines of the breadth-first-seatree). In summary, if a breadth-first token is createdthe root of its associated breadth-first tree, thent timesteps later there will be a token at each processoris a distance oft from the root, and none elsewher(If the tree has length less thant , of course, there wilbe no tokens anywhere.)

Loop tokenstravel along a specified marked loowithin the network. (How loops get marked is dscribed in Section 2.4.) A processor on the loop thaceives a loop token simply passes it to the next prosor on the loop. Thus,t time steps after its creation,loop token will bet processors away from the procesor that created it, along the marked loop. Whenloop token reaches it creator processor, it is absor(i.e., not sent around again).

Note that tokens can only carry along with themconstant (very small) amount of information since thare only of constant size. The next data structure tacare of this problem.

2.3. Snakes

Our description of the snake data structure closfollows that in [3]. The concept of a data-carryinsnakewas invented by Even, Litman, and Winklin [2]. Snakes are the solution to the problem oflimited data-carrying capabilities of tokens. A snais capable of carrying an arbitrarily large amountdata, but for this reason, it must reside in a collectof adjacent processors rather than a single proces

A “snake” is a string—which may be arbitrarillong—made up of an alphabet of 2(δ2+ δ)+1 charac-ters, namelyδ2 + δ head characters,δ2 + δ body char-acters, and a unique tail character. (Recall thatδ is afixed constant of the network.) The characters coprising the string are stored in adjacent processone character per processor. These characters encpath by specifying a series of in- and out-ports. (Nthat a token could never do such a thing, since a pin the network can grow arbitrarily long.)

We require two main snake types, which we cgrowing and dying.Growing snakesare used togenerate encoded paths of the network, anddying

a

specifically, we will need out-growing, in-growingout-dying, and in-dying snakes. “Out” and “in” ameant as a mnemonic; out-snakes are generatethe root and proceed outward from it, while in-snakare generated elsewhere and trigger some action wthey reach the root. Out-growing, in-growing, oudying, and in-dying snakes will be referred to as Osnakes, IG-snakes, OD-snakes, and ID-snakes infollows.

Each of the four kinds of snake gets its owalphabet of characters to describe it; this alloprocessors to determine with which kind of snake thare dealing. We will spend a section on each tyelucidating its respective behavior. First, we need toover some general rules common to all snake type

2.3.1. General snake-handling rules• All snakes are speed-1.• Snakes of different types do not interact. A proc

sor can handle different snake types simultaously without getting confused because sntypes are distinguished by their alphabets. Nthat this does not impose arduous memory cstraints upon the processors (which are finite-smachines) since there is only a constant numof snake types.

2.3.2. Growing snakesGrowing snakes function as information gene

tors. We define theinitiator to be the processor fromwhich the growing snakes first emanate. Thetermina-tor is defined to be the processor that the snakes artempting to reach. Growing snakes grow in a breadfirst manner; the first growing snake to reach theminator processor will have encoded within its boa minimal-length path from the initiator to the termnator. Upon reaching the terminator, a growing snhead might then initiate some further action basedthe protocol and the state of the terminator. The rufor handling growing snakes are outlined below;rules for handling in-growing and out-growing snakare identical (just replace “IG” with “OG”). We assume that we are using in-growing snakes in mosthe discussion below for concreteness.

Page 5: Determination of the topology of a directed network

D. Goldstein / Information Processing Letters 88 (2003) 121–131 125

• First, the head characters of the baby growingsnakes are generated by the initiator. This proces-

verylarthe

ter

cterlieses--

t.dus

akerst

n-ter

seeeheranchallyalout

akeghhet re-reryer-

IG-kerates

ne

δ, it simultaneously sends the characterIG(i,∗)

through out-porti; thus a new body character istionistail

eis

r athetedeyut-ngedID-cularkesuleslesce

anG-the

erer,ure

earill,as aith2)

acterin-ghssoresor.se

t #2.ent

sor sends an IG-snake head character out of eout-port during the first time step. The particuhead character to be sent will correspond toout-port from which it is being sent. For everyibetween 1 andδ, the growing head snake characIGH(i,∗) will be sent through out-porti. Whena processor receives any growing snake charawith ∗ as its second parameter (and this appto body as well as head characters), the procsor notes the in-portj through which the character arrived and changes the∗ to j . Thus, when theIGH(i,∗) is received, it is changed toIGH(i, j)

wherej is the number of the receiving in-porDuring the next time step, the initiator will sena tail character IGT through every out-port. Tha baby snake is born.

• When a processor receives an in-growing sncharacter (again, for concreteness) for the fitime, it marks itself IG-visited, and marks the iport through which the growing snake characwas passed as its IG-parent.1 (These marks willbe used later by certain breadth-first tokens;Section 4.2.1.) Only this first IG-snake will ballowed to pass through the processor; all otIG-snake characters will be ignored. Thus,IG-snake will carve out a breadth-first-seartree. Growing snake characters are periodicremoved from the network. Until this removoccurs, however, each growing snake carvesa breadth-first-search tree.

• When a processor receives a non-tail IG-sncharacter, it simply sends this character throuall out-ports during the next time step. Once tprocessor sends the character out, it need notain it in “memory”. (In this way, the processosimply passes the head and body through evout-port. Thus arbitrarily long paths can be genated.)

• Once a processor receives the tail of ansnake, instead of simply passing it through lithe other body characters, the processor genea new body character. For alli between 1 and

1 If two or more IG-snakes arrive simultaneously, the oarriving through the lowest-numbered in-port is deemed “first”.

generated to mark the current processor’s posiin the path. Only after this new characterpassed along does the processor send thethrough. Note that the∗ is changed to reflect thappropriate in-port when the body characterreceived by the next processor in turn.

2.3.3. Dying snakesDying snakes function as path markers. Afte

path is generated by the growing snakes, it isresponsibility of the dying snake to mark the generapath so that the processors on it will know (a) that thlie along a special path and (b) which in-port and oport they should use for funneling information alothe path. In our protocol, ID-snakes will be formby converting the characters of an OG-snake intosnake characters as they pass through one partiprocessor; OD-snakes will be created from ID-snain a manner to be described in Section 4.2.1. The rfor handling ID-snakes are outlined below; the rufor handling OD-snakes are identical (just repla“ID” with “OD”), except where noted.

• An ID-snake will mark a path generated byOG-snake (see Section 2.3.2); thus, since an Osnake carves out a breadth-first-search tree,path will never self-intersect. Similarly, neithwill a path that an OD-snake is to mark. Howevthe concatenation of the two paths (which, in oprotocol, will always be a loop that includes throot) may self-intersect; any processor will appat most twice on the concatenation. We weventually, want to consider the concatenationwhole; to this end, we imbue each processor wtwo “predecessor in-ports” (numbered 1 andand two “successor out-ports” (ditto).

• Whenever a processor receives the head charIDH(i, j) of an ID-snake, it sets predecessorport #1 equal to the number of the in-port throuwhich it received the character, and sets succeout-port #1 equal toi. These two values indicatthe two edges of the path incident to the procesOD-snakes work identically, except that they upredecessor in-port #2 and successor out-porThe head character is then discarded (not sthrough any out-port).

Page 6: Determination of the topology of a directed network

126 D. Goldstein / Information Processing Letters 88 (2003) 121–131

• If the next ID-snake character that the proces-sor receives through the predecessor in-port is

ut--con-ssesghex-s tosoreo-allakeex-ndingbe

t iserry

grilyisthus

ec-on

noit.

suc-ingt #1rt;sor-

; itbut

cessor in-port #2 set will only accept a loop tokenthrough that in-port; it will subsequently pass the to-

ssorpt

t #1#1,ghto-

ectport

re-ugh

sor

ata-nisngA

nyde-.2

otughkenorkt it

h in-is

e asandredrst-

iliartedsting

dge

ID(i ′, j ′), it gets sent through the successor oport asIDH(i ′, j ′). (In other words, the next IDsnake body character that comes through getsverted to the new head.) The processor then paall further ID-snake characters received throuits predecessor in-port to its successor out-portactly as received. If the next character happenbe a tail, then it gets sent through the succesout-port as is. In our protocol, ID-snakes will bconverted into OD-snakes at the root; this will prvide an exception to these rules, for at the rootID-snake characters are converted into OD-sncharacters instead. In addition, as might bepected, the root will set predecessor in-port #1 asuccessor out-port #2 appropriately as the dysnakes go through; its other two ports will notneeded, as we will show in Section 4.2.1.

• An ID-snake only propagates along the path imarking, and a maximum of one will be in thnetwork at any given time, so we need not woabout ID-visited markings.

2.4. Marked loops

As mentioned in Section 2.3.3, we will be usindying snakes to mark certain loops (not necessasimple) that include the root. We will refer to thstructure repeatedly throughout the paper, andmake the following definition:

Definition 2.1. A marked loopwill be a loop markedby dying snakes in the manner described in Stion 2.3.3. The root must be one of the processorsthe loop. The loop may or may not be simple, butprocessor or edge can appear more than twice on

Each processor will have its predecessor andcessor port (or, if necessary, ports) set by the dysnakes. A processor with only predecessor in-porset will only accept a loop token through that in-poit will subsequently pass the token through succesout-port #1.2 Similarly, a processor with only prede

2 Once again, the root will provide an exception to this rulewill accept a loop token only through predecessor in-port #1,will pass it through successor out-port #2.

ken through successor out-port #2. Finally, a procewith both predecessor in-ports set will initially accea given loop token only through predecessor in-por(it will pass the token through successor out-portof course); it then waits for the token to come throupredecessor in-port #2 (at which point it passes theken through successor out-port #2); it then will expthe next such loop token through predecessor in-#1 again.

We will hereon refer to the predecessor in-port (spectively corresponding successor out-port) throwhich a loop processor awaits a loop token as theap-propriate predecessor in-port (respectively succesout-port).

3. The Global Topology Determination Algorithm

3.1. Description of the algorithm

In the discussion to follow, we will assume thtwo auxiliary protocols, the Backwards Communiction Algorithm (BCA) and the Root CommunicatioAlgorithm (RCA), are available for use. The BCAa method for sending information “backwards” aloa unidirectional edge in the network, and the RCis a method for communication information from agiven node to the root. We defer more completescriptions of each until Sections 4.1 (BCA) and 4(RCA).

After initiation by its master computer, the roreleases a DFS (Depth First Search) token throits lowest-numbered connected out-port. This toperforms a depth first search of the entire netwremembering along the way through which out-porhas been most recently passed and through whicport it was most recently received. (The DFS tokento be thought of as having the same basic structura snake character with two entries where in-portout-port labels can be stored.) The information stoin this token is conveyed to the root as the depth-fisearch progresses.

We assume that the reader is somewhat famwith the mechanics of depth-first search on direcgraphs. We will give a brief overview of the depth-firsearch using finite-state processors. In the followdiscussion, a “forward edge” refers to an existing e

Page 7: Determination of the topology of a directed network

D. Goldstein / Information Processing Letters 88 (2003) 121–131 127

of the network representing a path along which mes-sages are passed unidirectionally. The reason we even

the

ionork,

es-,

FSits

est-gets

theandfi-ackotrch

theSo

n isarchthedge

fingareDort

theasinto

sic

, it

ardt. Inoken

• If the DFS token was received via a backwardsedge (i.e., if the token was passed to the processor

A

tedall

ingitsibe

log-m-

net-ingy thetheughem-osi-ith

theintsd al-ootill

isakean

f theoth

ort--ticpath,ryet

andm-isDar-ur-dr

di-

bother making this distinction is that because ofBCA, we have a method of passing informationback-wards through an edge. When a piece of informatgets passed through a legitimate edge of the netwwe say that it gets passedforward through the edge.

To perform the depth-first search, any given procsor, after receiving the DFS token for the first time3

notes the in-port through which it received the Dtoken. The processor also marks that in-port asparent and then passes the DFS token out its lownumbered connected out-port. After the processorthe DFS token backvia the BCA,4 it marks that out-port finished and sends the DFS token out oflowest-numbered unfinished connected out-port,so on. When all of the processor’s out-ports arenally finished, the processor sends the DFS token bthrough its parent in-port via the BCA. Once the rohas finished all of its out-ports, the depth-first seais over.

The root is updated as to the progress ofprotocol via the following. Upon receipt of the DFtoken, a processor initiates one of the following twtasks. Once the task is completed, the DFS tokepassed on according to the rules of depth-first-seoutlined above. (As indicated above, wheneverDFS token needs to move backwards along an eof the network, it uses the BCA.)

• If the token wasnot received through use othe BCA, the processor performs the RCA usthe FORWARD token. We assume that thereδ2 possible FORWARD tokens. The FORWARtoken that gets sent depends on which out-psent the DFS token and which in-port receivedDFS token. For example, if the DFS token wpassed out of out-port 4 of one processor andin-port 1 of another, then FORWARD token(4,1)

is sent. (The FORWARD token has the same bastructure as a snake character.)

3 If a processor is receiving the DFS token for the first timemust be through a forward edge of the network.

4 A processor may get the DFS token back through a forwedge of the network after it already has marked its parent in-porthat case, the processor would use the BCA to send the DFS tback since a processor never wants more than one parent.

by the BCA), the processor performs the RCusing the BACK token.

The algorithm terminates when the root has complethe depth first search of the network (i.e., finishedof its out-ports).

What is the master computer’s strategy for mappthe network given the computational transcript ofcommunication processor at the root? We will descrthe strategy as if the computer were drawing a topoical map as the algorithm was proceeding. The coputer always keeps track of the processors in thework that have performed previous RCAs, allocatthem names as new processors are “discovered” balgorithm. (Recall that the computer at the root hasability to assign processors unique names even thothe communicating devices at the processors thselves cannot.) It will keep a stack of processor ptions as well. When a processor performs an RCA wa FORWARD token, the computer pushes it ontostack. The processor at the top of the stack then poto the processor that has most recently performeRCA. (If the root has just initiated the Global Topoogy Determination Protocol then we consider the ritself as having performed the last RCA; the stack winitially consist of only the root.) Whenever an RCArun, the computer notes the characters of the IG-snthat passes through the root as it is converted toOG-snake (see Lemma 4.1). From the characters oIG-snake, the root computer can accurately map bthe in-ports and the out-ports of the canonical shest path to the current processorA, the processor running the RCA. Because the protocol is determinisand always produces the same canonical shortestfrom any given processorA to the root and back againthe computer can tell whether the current processoA

has already been marked on the map. If it has notbeen marked on the map, the computer marks itcreates a name for it. At the end of the RCA, the coputer notes whether a FORWARD or BACK tokenbeing passed around the loop. If it is a FORWARtoken, then the computer should draw a directedrow from the top processor on the stack to the crent processorA through the appropriate out-port anin-port. Afterwards, the computer pushes processoA

onto the stack. (Recall that a FORWARD token in

Page 8: Determination of the topology of a directed network

128 D. Goldstein / Information Processing Letters 88 (2003) 121–131

cates that the depth first search has moved forwardalong an edge.) If it is a BACK token, the computer

hatf the

)g:

r

e,aphf

e

ngh

,mer-alec-s-that

otout-rom

ouslynessn

the root to processorA and from processorA to theroot, and at the end of the transaction, the graph is left

totohegyun-

e.es-ith

ke

toedontoanelfentteastinIG-

toe-

erheise-ke

on-putut.)

hatdheds

t the

simply pops the top processor off the stack. Note tthe top processor on the stack tracks the position oDFS token at any given point in time.

4. Auxiliary protocols and correctness proofs

4.1. The Backwards Communication Algorithm

The Backwards Communication Algorithm (BCAfirst appeared in [7] and accomplishes the followinAssume there is a directed edge from processorA toprocessorB in the network. The BCA is a method fosending a message from processorB to processorA(backwardsthrough the directed edge) such thatA getsthe message,B knows whenA has gotten the messagand at the end of the transaction, the rest of the gris left undisturbed.5 The running time for each use othe BCA is O(D).

Definition 4.1. Given two distinct processors in thnetwork, processorA and processorB, we define thecanonical shortest pathfrom processorA to processorB to be the unique path along which the first growisnake released from processorA that survives to reacprocessorB would travel.

4.2. The Root Communication Algorithm

In this section we will outline another algorithmwhich we call the Root Communication Algorith(RCA), based on the idea of Ostrovsky and Wilkson’s BCA, which we will use as part of the GlobTopology Determination Protocol presented in Stion 3. The RCA accomplishes the following: procesor A communicates a message to the root suchthe root gets the message, processorA is aware of thecompletion of the algorithm, the computer at the rois able to reconstruct the sequence of in-ports andports along the canonical shortest paths leading f

5 It is important to note that the namesA andB are just namesfor the reader’s convenience. Processors cannot all simultaneassign themselves unique names because of their finite-stateProcessorB only recognizes processorA as the processor that is othe other end of one of processorB ’s in-ports.

.

undisturbed. This auxiliary algorithm will be usedsend one of the two signals FORWARD or BACKthe root and to allow the root computer to track tmovement of the DFS token. The Global TopoloDetermination Protocol is guaranteed to only be rning the RCA at a single processor at any given timThroughout this section, we will assume that procsorA is the processor that wishes to communicate wthe root.

4.2.1. The steps of the Root CommunicationAlgorithm

For the sake of brevity, we will abbreviate the snatypes.

(1) ProcessorA becomes aware that it wishescommunicate with the root (via a process outlinin the steps of the Global Topology DeterminatiAlgorithm in Section 3) and sends IG-snakessearch for the root. Any processor receivingIG-snake character for the first time marks itsas “IG-visited”, thus preventing any subsequIG-snakes from entering it. It will also designathe in-port from which it received the IG-snakeits “IG-parent” in-port. These markings will nobe cleared until the release of KILL tokens (Step 4); hence, the IG-snakes carve out anbreadth-first-search tree.

(2) Upon receipt of the head of the first IG-snakereach it, the root performs two actions simultanously. First, the root closes itself off to all othIG-snakes, ignoring any that attempt to enter. Troot will accept no further IG-snakes during thexecution of the algorithm. Second, the root bgins to convert the IG-snake to an OG-snawhich it broadcasts out all out-ports. (Toconvertan IG-snake to an OG-snake, the root simply cverts the IG-snake characters it receives as into OG-snake characters when they are sent oWhen the root receives the tail of the IG-snake tit is converting, it simply holds onto the tail ancontinues growing the OG-snake normally: Troot holds onto the tail character while it senout the characterOG(i,∗) out of each of its out-ports for everyi between 1 andδ. Only after thischaracter is broadcast does the root send ou

Page 9: Determination of the topology of a directed network

D. Goldstein / Information Processing Letters 88 (2003) 121–131 129

tail of the snake as OGT. OG-snakes leave “OG-visited” and “OG-parent” markings (and thus cre-

theG-

archack

e

OG-

akethert).soradas

rks

she

-first

keketac

ingry.c-n.

et-

ekesly

Ksor

enses

out-sso

designations. Upon reception of this UNMARKtoken, the root reopens itself to IG-snakes. Af-

he

lgo-

s

toand.

mhechuterdedan

teststheplyID-

-s-hm

tertu-

es.ly

rk,

pthep

en

ate an OG-breadth-first-search tree) similar toIG-snakes discussed in Step 1. However, the Osnakes do not respect the IG-breadth-first-setree and are therefore guaranteed to make it bto processorA.

(3) When processorA receives the first OG-snakhead that survives, processorA closes itself off toany subsequent OG-snakes and converts thesnake to an ID-snake (note that processorA musttherefore eat the head character of the OG-snas if it were an ID-snake character, then sendrest of the snake through the appropriate out-poThe ID-snake then marks the path from procesA to the root. Eventually the root receives the heof an ID-snake and converts it to an OD-snakepreviously described. This OD-snake then mathe path from the root back to processorA whichwill only receive the tail character ODT. At thipoint in the protocol, there is a marked path in tnetwork from processorA to the root and backagain.

(4) As soon as processorA receives the tail of theOD-snake, processorA performs two tasks simultaneously. First, it releases a speed-3 breadth-KILL token. The function of the KILL token is tocompletely eradicate all traces of growing snacharacters in the network; both IG- and OG-snacharacters and markings are erased upon conwith a KILL token. KILL tokens are ignored bythose processors that do not have any growsnake markings or characters in their memo(KILL tokens do not affect the marked path.) Seond, processorA releases a speed-1 loop tokeThis token will either be a FORWARD or BACKtoken depending on the current state of the nwork. Upon reception of the FORWARD/BACKtoken, processorA is guaranteed that one timstep later, there will be no further growing snacharacters or KILL tokens percolating uselesthrough the network.

(5) ProcessorA finally releases a speed-3 UNMARtoken around the marked path. Each procesthe old marked loop, upon receiving the tokthrough its appropriate predecessor in-port, pasthe token through the appropriate successorport, then forgets those predecessor and succe

t

r

ter the token makes it all the way around tmarked path back to processorA, processorA re-opens itself to OG-snakes and terminates the arithm.

4.2.2. Proof of correctness of the RCAIn this section, we prove the non-trivial claim

made about the RCA presented in Section 4.2.1.

Lemma 4.1. The root’s master computer is abledetermine the canonical shortest paths leading tofrom processorA by the completion of the algorithm

Proof. Note that the canonical shortest path froprocessorA to the root is unique and is encoded in tbody of the first (and only) IG-snake to safely reathe root. Thus, to track this path, the master compcan simply read off the in-ports and out-ports encoin the body of the IG-snake as it is converted toOG-snake in Step 2. Similarly the canonical shorpath from the root to processorA is also unique and iencoded in the body of the ID-snake that reachesroot in Step 3. The master computer can again simread off the relevant in-ports and out-ports as thesnake is converted to an OD-snake.✷Lemma 4.2. After processorA terminates the algorithm in Step5, the network is left completely unditurbed by any data construct created by the algorit(snake characters/markings, tokens, etc.).

Proof. Because KILL tokens travel three times fasthan snakes, it is obvious that the tokens will evenally catch up with and eliminate the growing snakTo see that the KILL tokens will catch up precisewhen claimed (see Step 4), note that ifL is thelength of the current marked loop in the netwothen the snake heads have at most a 2L head start.This implies that the KILL tokens will catch uwith the snake heads after a speed-1 token (i.e.,FORWARD/BACK token) makes it around the looonce. ✷Lemma 4.3. Each execution of the RCA by any givprocessorA takes timeO(D).

Page 10: Determination of the topology of a directed network

130 D. Goldstein / Information Processing Letters 88 (2003) 121–131

Proof. By inspection of the steps, the running-timeis proportional to the length of loop marked by the

n

at

t

rko-

Dors

othun,entroosoradyandeenimebendthe

-

tant

r

vethe

family of networks that consist of a full binary treeemanating from a single node with bidirectional edges

aot-

arere-on

le

in-f

um

alex-

alhat

nt

iptsise,rktly

rse,

ghfualles at

-

algorithm: d(A, root) + d(root,A). This quantity isitself trivially O(D). ✷4.3. Correctness proof of the Global TopologyDetermination Algorithm

Lemma 4.4. The Global Topology DeterminatioAlgorithm terminates in timeO(ND).

Proof. Each processor in the network performsmostδ RCAs and at mostδ BCAs. The running timefor each of these subalgorithms is O(D) and the resulfollows. ✷Theorem 4.1. The computer at the root of a netwoperforming the Global Topology Determination Algrithm accurately maps the given directed network.

Proof. First, we claim that any time a FORWARtoken is noted by the root computer, the two processbetween which it draws the directed arrow have balready been mapped. Every time an RCA is rprocessorA must be mapped before the token is sout because a IG-snake must be sent through thebefore a FORWARD token. The previous proces(i.e., the processor on top of the stack) has alrebeen mapped by a previous execution of the RCAthus a FORWARD token can always be traced betwtwo processors already on the network map at the tit is sent. Now we note that the DFS token mustsent forward through every edge of the network ahence a FORWARD token is sent for every edge ofnetwork. Thus all edges get accurately mapped.✷

5. The lower time bound

Lemma 5.1. Let G(N) be the number of boundeddegree strongly connected networks ofN processorsand diameter less than or equal to2 logN + 1 withdistinct topologies. Then there exists some consC such that, for large enoughN , G(N) � NCN (i.e.,there are a great many networks with small diamete).

Proof. We only present a quick justification and leathe interested reader to fill in the details. Consider

t

(i.e., unidirectional edges in both directions) withsimple loop that includes every processor on the btom level of the tree. Note that all such networksof bounded-degree and strongly connected. Everyarrangement of the processors included in the loopthe bottom levels yields a distinct topology. A simpcounting argument suffices to complete the proof.✷

We make the convention that the processors’put/output set is calledI . The number of elements othe setI is |I |.

Lemma 5.2. For any given algorithm, afterx globalclock ticks, the root can have had one of a maximof |I |δx possible computational transcripts.

Theorem 5.1. Any algorithm which solves the GlobTopology Determination Problem has a time-complity lower bound of�(N logN).

Proof. Fix an algorithm which solves the GlobTopology Determination Problem. Let us assume tthe algorithm terminates on graphs withN processorsin less than or equal toT (N) global clock ticks.

In order for the root to distinguish between differeglobal topologies, for any given network sizeN , theremust be at least as many computational transcras there are distinct network topologies. Otherwby the pigeonhole principle, two distinct netwotopologies would have to be distinguished by exacthe same computational transcript which is, of couimpossible.

By Lemma 5.1, we know that for large enouN , there exists a constantC such that the number odistinct network topologies is greater than or eqto NCN . By Lemma 5.2, the number of possibcomputational transcripts the root can have had imost|I |δT (N). Thus we get:

|I |δT (N) � NCN ⇒ T (N) = �(N logN). ✷

References

[1] H. Burch, B. Cheswick, Mapping the Internet, IEEE Comput. 32 (4) (1999) 97–98, 102.

Page 11: Determination of the topology of a directed network

D. Goldstein / Information Processing Letters 88 (2003) 121–131 131

[2] S. Even, A. Litman, P. Winkler, Computing with snakes indirected networks of automata, J. Algorithms 24 (1) (1997) 158–

as-ionte78–

ap

[5] A. Mainwaring, B. Chun, S. Schleimer, D. Wilkerson, Systemarea network mapping, in: ACM Symp. on Parallel Algorithms

s,

tedonust

170.[3] D. Goldstein, N. Meyer, The wake up and report problem is

ymptotically time-equivalent to the firing squad synchronizatproblem, in: Proc. 13th Annual ACM-SIAM Symp. on DiscreAlgorithms, San Francisco, CA, 6–8 January 2002, pp. 5587.

[4] R. Govindan, H. Tangmunarunkit, Heuristics for Internet mdiscovery, in: INFOCOM (3), 2000, pp. 1371–1380.

and Architectures, 1997.[6] M. Minsky, Computation: Finite and Infinite Machine

Prentice-Hall, Englewood Cliffs, NJ, 1967.[7] R. Ostrovsky, D. Wilkerson, Faster computation on direc

networks of automata, in: Proc. 14th Annual ACM Symp.Principles of Distributed Computing, Ottawa, ON, 2–23 Aug1995, pp. 38–46.