A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

9
A GRAPH THEORETIC MODEL OF DATA STRUCTURES J. Heller and Ben Schneiderman Department of Computer Science State University of New York at Stony Brook The widespread development of large shared data bases has proceeded mainly on empirical no- tions. Only in the past few years have there been attempts at formalizing the underlying concepts in- to a theory of data structures. The present models have been founded on the well-established mathe- matical theories of sets, relations and graphs, but few descriptions have been sufficiently developed to meet the needs of a complete theory of data structures. The set theoretic formalism offered by Childs(I) or Schwartz(2) or the relational model by Codd(3) are useful but fail to give a complete de- scription of the complex structures found in modern data bases. The graph theoretic concepts found in papers by Harary and Hsiao(4) and Earley(5) are more appealing but need further elaboration. This paper is an attempt to develop a graph theoretic model into a useful formalism for describing and manipu- lating data structures. Data existed long before computers were ever dreamed of and even the first librarian had some notion of the organization and structure of his data. Clearly, information has a logical structure inde- pendent of the physical implementation inside a computer. A theory of data structures should de- scribe the logical structure separately from the implementation but should enable the system de- signer to evaluate the effectiveness a particular implementation. Furthermore, the theoretical form- lation should be intuitively appealing and accept- able to data managers, such as librarians and executives, who may not have a sophisticated un- derstanding of computer technology and techniques. The computer scientist must provide the data manager with a "magic genie" for manipulating data according to this logical view of the data. To motivate the formal definitions of a graph theoretic model, we consider three simple examples: a one-way list with top and bottom pointers, a ring with one entry node, and a full balanced binary tree with one entry node. Since one of the strong arguments in favor or the graph theoretic model are the visual cues taken from the picture of the graph, we will make frequent use of such pictures. Thus a one-way list with top and bottom pointers looks like: ***Figure I*** The square nodes E={el,e2}, called entry nodes, provide access to the data nodes D={dl...dn}. In- formally, the entry nodes are always instantly ac- cessible and all searches must begin at an entry node. The graph describes the logical structure of the data and the connections among the data nodes. The nodes can contain any amount of information and may have a complex substructure which might be an- other graph. One of the virtues of the graph de- scribe data at the detailed level and the complex structure of entire files. The logical structure given by the graph may be implemented in a multiplicity of ways. The data nodes might be maintained in the processor storage with implicit or explicit pointers. Alternatively, each node could be a region on a disk file with region addresses as the pointers. The relationship among the nodes is described by a mapping F:(D U E) + D where, in our example, Pel={d I } Pe2={ d } Pd i =({~i+l} l=ni<n We can compound the mapping F2di = F(Fdn) = ({~i+2} i>n-li<n-i In general Fnd. = Fn-l(Fdi) = F(Fn-ldi) l We further define the inverse map F-idi = ({~i-l} l<i<ni=l and an identity or zero map FOdi = {d i} In general the mapping is not single valued, but yields a set of nodes, that is Fd = A = {d ,... d. } 1 i k where k is the out-degree of the node d. Thus F2d = FA = Fd. 11 U F%2 U "-- ~J rdik or more succinctly, F2d = FA = Q Fd YdeA 3 6

Transcript of A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 1/9

A G R A P H T H E O R E T I C M O D E L O F D A T A S T R U C T U R E S

J . H e l l e r a n d B e n S c h n e i d e r m a n

D e p a r t m e n t o f C o m p u t e r S c i e n c e

S t a t e U n i v e r s i t y o f N e w Y o r k a t S t o n y B r o o k

T h e w i d e s p r e a d d e v e l o p m e n t o f l a r g e s h a r ed

d a t a b a s e s h a s p r o c e e d e d m a i n l y o n e m p i r i c a l n o -

t i o n s . O n l y i n t h e p a s t f e w y e a r s h a v e t h e r e b e e n

a t t e m p t s a t f o r m a l i z i n g t h e u n d e r l y i n g c o n c e p t s i n -

t o a t h e o r y o f d a t a s t r u c t u r e s . T h e p r e s e n t m o d e l s

h a v e b e e n f o u n d e d o n t h e w e l l - e s t a b l i s h e d m a t h e -

m a t i c a l t h e o r i e s o f s e t s , r e l a t i o n s a n d g r a p h s , b u t

f e w d e s c r i p ti o n s h a v e b e e n s u f f i c i e n t l y d e v e l o p e d

t o m e e t t h e n e e d s o f a c o m p l e t e t h e o r y o f d a t a

s t r u c t u re s . T h e s e t t h e o r e t i c f o r m a l i s m o f f e r e d b y

C h i l d s ( I ) o r S c h w a r t z ( 2 ) o r t h e r e l a t i o n a l m o d e l b y

C o d d ( 3 ) a r e u s e f u l b u t f a i l t o g i v e a c o m p l e t e d e -

s c r i p t i o n o f t h e c o m p l e x s t r u c t u r e s f o u n d i n m o d e r n

d a t a b a s e s . T h e g r a p h t h e o r e t i c c o n c e p t s f o u n d i np a p e r s b y H a r a r y a n d H s i a o ( 4 ) a n d E a r l e y ( 5 ) a r e m o r e

a p p e a l i n g b u t n e e d f u r t h e r e l a b o r a t i o n . T h i s p a p e r

i s a n a t t e m p t t o d e v e l o p a g r a p h t h e o r e t i c m o d e l

i n t o a us e f u l f o r m a l i s m f o r d e s c r i b i n g a n d m a n i p u -

l a t i n g d a t a s t r u c t u r e s .

D a t a e x i s t e d l o n g b e f o r e c o m p u t e r s w e r e e v e r

d r e a m e d o f a n d e v e n t h e f i r s t l i b r a r i a n h a d s o m e

n o t i o n o f t h e o r g a n i z a t i o n a n d s t r u c t u r e o f h i s d a ta .

C l e a r l y , i n f o r m a t i o n h a s a l o g i c a l s t r u c t u r e i n d e -

p e n d e n t o f t h e p h y s i c a l i m p l e m e n t a t i o n i n s i d e a

c o m p u t e r . A t h e o r y o f d a t a s t r u c t u r e s s h o u l d d e -

s c r i b e t h e l o g i c a l s t r u c t u r e s e p a r a t e l y f r o m t h e

i m p l e m e n t a t i o n b u t s h o u l d e n a b l e t h e s y s t e m d e -

s i g n e r t o e v a l u a t e t h e e f f e c t i v e n e s s a p a r t i c u l a r

i m p l e m e n t a t i o n . F u r t h e r m o r e , t h e t h e o r e t i c a l f o r m -

l a t i o n s h o u l d b e i n t u i t i v e l y a p p e a l i n g a n d a c c e p t -

a b l e t o d a t a m a n a g e r s , s u c h a s l i b r a r i a n s a n de x e c u t i v e s , w h o m a y n o t h a v e a s o p h i s t i c a t e d u n -

d e r s t a n d i n g o f c o m p u t e r t e c h n o l o g y a n d t e c h n i q u e s .

T h e c o m p u t e r s c i e n t i s t m u s t p r o v i d e t h e d a t a

m a n a g e r w i t h a " m a g i c g e n i e " f o r m a n i p u l a t i n g d a t a

a c c o r d i n g t o t h i s l o g i c a l v i e w o f t h e d at a .

T o m o t i v a t e t h e f o r m a l d e f i n i t i o n s o f a g r a p h

t h e o r e t i c m o d e l , w e c o n s i d e r t h r e e s i m p l e e x a m p l e s :

a o n e - w a y l i s t w i t h t o p a n d b o t t o m p o i n t e r s , a r i n g

w i t h o n e e n t r y n o d e , a n d a f u l l b a l a n c e d b i n a r y

t r e e w i t h o n e e n t r y n o d e .

S i n c e o n e o f th e s t r o n g a r g u m e n t s i n f a v o r

o r t h e g r a p h t h e o r e t i c m o d e l a r e t h e v i s u a l c u e s

t a k e n f r o m t h e p i c t u r e o f t h e g r a p h , w e w i l l m a k e

f r e q u e n t u s e o f s u c h p i c t u r e s . T h u s a o n e - w a y

l i s t w i t h t o p a n d b o t t o m p o i n t e r s l o o k s l i k e :

* * * F i g u r e I * * *

T h e s q u a r e n o d e s E = { e l , e 2 } , c a l l e d e n t r y n o d e s ,

p r o v i d e a c c e s s t o t h e d a t a n o d e s D = { d l . . . d n } . I n -

f o r m a l l y , t h e e n t r y n o d e s a r e a l w a y s i n s t a n t l y a c -

c e s s i b l e a n d a l l s e a r c h e s m u s t b e g i n a t a n e n t r y

n o d e . T h e g r a p h d e s c r i b e s t h e l o g i c a l s t r u c t u r e

o f t h e d a t a a n d t h e c o n n e c t i o n s a m o n g t h e d a t a n o d e s .

T h e n o d e s c a n c o n t a i n a n y a m o u n t o f i n f o r m a t i o n a n d

m a y h a v e a c o m p l e x s u b s t r u c t u r e w h i c h m i g h t b e a n -

o t h e r g r a p h . O n e o f t h e v i r t u e s o f t h e g r a p h d e -

s c r i b e d a t a a t t h e d e t a i l e d l e v e l a n d t h e c o m p l e x

s t r u c t u r e o f e n t i r e f i l e s .

T h e l o g i c a l s t r u c t u r e g i v e n b y t h e g r a p h m a y

b e i m p l e m e n t e d i n a m u l t i p l i c i t y o f w a y s . T h e d a ta

n o d e s m i g h t b e m a i n t a i n e d i n t he p r o c e s s o r s t o r a g e

w i t h i m p l i c i t o r e x p l i c i t po i n t e r s . A l t e r n a t i v e l y ,

e a c h n o d e c o u l d b e a r e g i o n o n a d i s k f i l e w i t h

r e g i o n a d d r e s s e s a s t h e p o i n t e r s .

T h e r e l a t i o n s h i p a m o n g t h e n o d e s i s d e s c r i b e d

b y a m a p p i n g

F : ( D U E ) + D

w h e r e , i n o u r e x a m p l e ,

Pel ={d I } Pe2 ={ d } Pd i = ({~ i+l } l=ni<n

W e c a n c o m p o u n d t h e m a p p i n g

F2 di = F(Fd n) = ({ ~i +2 } i>n-li<n-i

I n g e n e r a l

F n d . = F n - l ( F d i ) = F ( F n - l d i )l

W e f u r t h e r d e f i n e t h e i n v e r s e m a p

F-i di = ({ ~i -l } l<i<ni=l

a n d a n i d e n t i t y o r z e r o m a p

F O d i = { d i }

I n g e n e r a l t h e m a p p i n g i s n o t s i n g l e v a l u e d ,

b u t y i e l d s a s e t o f n o d e s , t h a t i s

Fd = A = {d ,... d. }

1 i k

w h e r e k i s t h e o u t - d e g r e e o f t h e n o d e d .

T h u s

F2d = FA = Fd.1 1 U F % 2 U " - - ~ J r d i k

o r m o r e s u c c i n c t l y ,

F 2 d = F A = Q F d

Y d e A

36

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 2/9

F I G U R E 1

F I G U R E 2

F I G U R E 3

F I G U R E 4

37

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 3/9

A s o u r s e c o n d e x a m p l e w e c o n s i d e r a r i n g w i t h

o n e e n t r y n o d e

* * * F i g u r e 2 * * *

T h e g r a p h c o n s i s t s o f t h e e n t r y n o d e s e t E = { e l } a n d

t h e d a t a n o d e s e t D = { d l . . . d n } a n d t h e m a p p i n g

F e { d l } F d i { d i + l } l < i < n= = { d I } i = -- n

N o t i c e t h a t i n b o t h o u r e x a m p l e s t h e r e a r e n o n o d e s

" f l o a t i n g " f r e e l y t h a t a l l n o d e s a r e c o n n e c t e d a n d

a n y d a t a n o d e i s r e a c h a b l e b y f o l l o w i n g a p a t h

f r o m o n e o f t h e e n t r y n o d e s .

A s o u r t h i r d e x a m p l e w e c o n s i d e r a f u l l y b i n a r y

t r e e w i t h a s i n g l e e n t r y n o d e E = { e l } a n d D = { d l . . . d n }

w h e r e n i s 2 k - i f o r s o m e i n t e g e r k , w h i c h r e p r e s e n t s

t h e n u m b e r o f l e v e l s i n t h e t r e e .

* * * F i g u r e 3* * *

T h e m a p p i n g F fo r t h i s s t r u c t u r e i s d e f i n e d b y

l < 2 k - l _ 1F e = { d l } F d i = ~ { d 2 i , $ 2 i + i }

i > 2 k - i

C l e a r l y , a l l d a t a n o d e s a r e r e a c h a b l e f r o m t h e

s i n g l e e n t r y n o d e w i t h a m a x i m u m n u m b e r o f s t e p s

e q u a l t o k , t h a t i s

k =(.7 Fi el D

i = l

A n a l y s i s o f t h e s e t h r e e e x a m p l e s a n d t h e s t u d y

o f a w i d e v a r i e t y o f c o m m o n l y u s e d s t r u c t u r e s m o t i -

v a t e s t h e d e f i n i t i o n o f a W e l l - F o r m e d L i s t S t r u c -

t u r e ( W D L S ). D e f i n i t i o n : L = ( D , E , F ) i s a W e l l -

F o r m e d L i s t S t r u c t u r e i f a n d o n l y i f ( 1) D ~ E i s a

c o n n e c t e d s e t o f n o d e s , t h a t i s , i f w e r e m o v e t h e

d i r e c t i o n o n t h e d i r e c t i o n o n t h e e d g e s , t h e r e i s

a p a t h b e t w e e n e v e r y p a i r o f n o d e s .

F o r m a l l y i f A = D L T E = { a i l i = l . . . n }

k

¥ (i ,j )~ . . . . . . a. a . ~ . ~F a. , k = + la l a i l a 1 2 a l 3 l £ j - i ~ + 1 m R

( 2) E i s a n o n - e m p t y s e t o f n o d e s w i t h e a c h n o d e

h a v i n g i n - d e g r e e z e r o a n d D i s a n o n - e m p t y s e t

o f no d e s w i t h n o d e h a v i n g a n i n - d e g r e e g r e a t e r

t h a n z e r o .

F o r m a l l y E # ~ V e e E F - l e = ~

D # ~ V d c D r - l d # ~

( 3) A n y n o d e i n t h e s e t D i s r e a c h a b l e f r o m a t

l e a s t o n e o f t h e n o d e s i n t h e s e t E .

F o r m a l l y , O * F i E = D = F E ( 2 F 2 E iT. • ~ 2 F n * E

i = l

w h e r e n * i s t h e s m a l l e s t i n t g g e r f o r w h i c h t h i st r u e . C o n d i t i o n ( i ) i s m e a n t t o e x c l u d e s t r u c t u r e s

s u c h a s

* * * F i g u r e 4 * * *

w h i c h a r e t w o W F L S s w h i c h a r e n o t c o n n e c t e d . C o n d i -

t i o n ( 2 ) i s m e a n t t o e x c l u d e s t r u c t u r e s s u c h a s

* * * F i g u r e 5 * * *

w h i c h i s a r i n g w i t h o u t a n e n t r y n o d e , a n d

* * * F i g u r e 6 * * *

w h i c h i s a d e g e n e r a t e o n e w a y l i s t w i t h t o p a n d

b o t t o m p o i n t e r s , t h a t i s, a s t r u c t u r e w i t h o u t d a t a

N o t i c e t h a t t h i s s t r u c t u r e a l s o v i o l a t e s c o n d i t i o n

( i) c o n c e r n i n g c o n n e c t e d n e s s . F u r t h e r v i o l a t i o n s

o f c o n d i t i o n ( 2) a r e

* * * F i g u r e 7 * * *

s i n c e e n t r y n o d e s m a y n o t p o i n t t o e a c h o t h e r a n d

* * * F i g u r e 8 * * *

s i n c e d a t a n o d e s m a y n o t p o i n t t o e n t r y n o d e s .

F i n a l l y c o n d i t i o n ( 3) is m e a n t t o e x c l u d e s t r u c t u r e s

s u c h a s

* * * F i g u r e 9 * * *

w h i c h c o n t a i n s a n o n - r e a c h a b l e r i n g.

T h e s t a t i c d e s c r i p t i o n o f a d a t a s t r u c t u r e i s

n o t s u f f i c i e n t ; o u r m o d e l m u s t i n c l u d e a n o t a t i o n

f o r d y n a m i c a l l y m a n i p u l a t i n g t h e s e s t r u c t ur e s . C o n -

s i d e r t h e s t a t i c d e s c r i p t i o n o f a s t a c k S = ( D , E , F ) ,

D = { d l . • . a n } , E = { e l } ,

F e l = { d n } ' d i = ~ { d ~ - I } i = l< i < n

• * * F i g u r e i 0 " * *

T h i s c o u l d J u s t a s e a s i l y d e s c r i b e a o n e w a y l i s t

W i t h a t o p p o i n t e r o n l y . W h a t d i s t i n g u i s h e s t h e

a b o v e s t r u c t u r e a s a s t a c k a r e t h e d y n a m i c o p e r a -

t i o n s w h i c h a r e d e f i n e d f o r a s t a c k : P U S H o r P O P .

F o r a s t a c k w e d e f i n e P O P ( S) a s a t r a n s f o r m a t i o n

w h i c h p r o d u c e s a n e w s t r u c t u r e s S ' = P O P ( S ) w h e r e

S ' = ( D ' , E ' , F ' ) , D ' = { d l . . . d n _ l } , E ' = { e l } ,

F , e l = { d n _ ~ F , d i = < { d ~ _ I } l <i< n-l i= ~

* * * F i g u r e i i * * *

S i m i l a r l y , w e d e f i n e S ' ' = P U S H ( S) w h e r e

S ' ' = ( D " , E " , F " ) ,

D " = { d l . . . d n + l } , E " = { e l } ,

F" el ={ dn +l } 'F" di= {{ d~ -I} i=ll<i<--n+l

* * * F i g u r e 1 2 " * *

A t w o w a y l i s t w i t h t o p a n d b o t t o m p o i n t e r s

* * * F i g u r e 1 3 " * *

i s i d e n t i c a l w i t h a q u e u e o r a d i - q u e ( d e q u e ) w h e n

e x a m i n e d f o r s t a t i c s t r u c t u r e . O n l y b y o b s e r v i n gt h e d y n a m i c o p e r a t i o n s w h i c h a r e p e r m i t t e d c a n w e

d i s t i n g u i s h b e t w e e n t h e s t r u c t ur e s .

A n a l o g o u s o p e r a t i o n s o f a d d i t i o n a n d d e l e t i o n

o f n o d e s c a n b e d e f i n e d f o r o t h e r s t r u c t u r e s a n d

c a n e a s i l y b e d e s c r i b e d a n d i m p l e m e n t e d i n t e r m s o f

p r o g r a m m i n g l a n g u a g e s u b r o u t i n e s . S u c h a d i s c u s s i o n ,

w h i l e u s e f u l , w o u l d n o t c o n t r i b u t e t o t h e d e v e l o p m e n t

o f a m o r e p r o f o u n d c o n c e p t u a l i z a t i o n o r f o r m a l i z a -

t i o n o f d a t a s t r u c t u r e s . W e s e e k a m o r e g e n e r a l ,

a b s t r a c t t h e o r y w h i c h w o u l d s u b s u m e e a c h o f t h e s e

3 8

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 4/9

I I

F I G U R E 9

F I G U R E 6

I

<

I

) <

F I G U R E 7

F I G U R E 5

)

F I G U R E 8

F I C U R E I 0

F I G U R E i ]

F IO [~ R E 1 2

• . - - ~ )

3 9

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 5/9

d i s c u s s i o n s a s a s p e c i a l c a s e . T h u s , w e a r e l e d t o

c o n s i d e r t h e p r i m i t i v e s o f g r a p h t h e o r e t i c o p e r a -

t i o n s .

C e r t a i n l y w e m u s t b e a b l e t o

i ) A d d a n o d e a n d a b r a n c h

E x a m p l e : A d d a n e w l e a f t o a t r e e

2 ) I n s e r t a n o d e a n d a b r a n c h a n d c h a n g e a t

l e a s t o n e b r a n c h

E x a m p l e : I n s e r t a n o d e i n a o n e - w a y l i s t

3 ) A d d a b r a n c h t o c o n n e c t tw o a l r e a d y e x i s t -

i n g n o d e s

E x a m p l e : A d d a b r a n c h t o c o n v e r t a o n e -

w a y l i s t i n t o a r i n g

a n d w e m u s t b e a b l e t o p e r f o r m t h e d e l e t e o p e r a t i o n s

w h i c h a r e t h e i n v e r s e o p e r a t i o n s :

i ) D e l e t e a n o d e a n d a b r a n c h p o i n t i n g t o that

n o d e

E x a m p l e : D e l e t e a n o d e o f a t r e e a n d t h e

b r a n c h p o i n t i n g t o th a t n o d e

2 ) D e l e t e a n i n t e r n a l n o d e w i t h i t s o u t g o i n g

a n d i n c o m i n g b r a n c h e s

E x a m p l e : . D e l e t e a n o d e i n a o n e - w a y l i s t

3 ) D e l e t e a b r a n c h w h i c h l e a v e s t h e s t r u c t u r e

w e l l f o r m e d

E x a m p l e : D e l e t e a b o t t o m p o i n t e r

T h e k e y p o i n t i n t h e s e s i m p l e o p e r a t i o n s i s

t h a t e a ch t r a n s f o r m a t i o n m u s t b e d e f i n e d s o as t om a i n t a i n a W F L S .

E n t i r e s t r u c t u r e s c a n b e a d d e d o r d e l e t e d. W e

m i g h t b e i n t e r e s t e d i n a d d i n g a s u b - t r e e a t a l e a f

F r e e o r i n a d d i n g a o n e w a y l i s t t o a o n e w a y l i s t .

S i m i l a r l y , w e m i g h t d e l e t e l a r g e s e c t i o n s o f a

s t r u c t u r e b y c r e a t i n g s u b g r a p h s o r p a r t i a l g r a p h s .

A s u b g r a p h i s c r e a t e d b y d e l e t i n g a n e d g e a n d

t h e n d e l e t i n g a l l u n c o n n e c t e d n o d e s a n d b ra n c h e s .

A p a r t i a l g r a p h i s c r e a t e d b y d e l e t i n g a n o d e a n d

t h e n e l i m i n a t i n g u n c o n n e c t e d n o d e s a n d b r a n c h e s .

I n a d d i t i o n t o t r a n s f o r m a t i o n s o f a W F L S w e

n e e d t o b e a b l e t o d e s c r i b e t h e r u l e s f o r c o m b i n -

i n g p a i r s o f W F L S s . T w o W F L S s c a n b e c o m b i n e d t o

f o r m a s i n g l e W F L S i n o n l y t w o w a y s

* * * F i g u r e 1 4 " * *

I n t h e s e t w o p i c t u r e s w e a s s u m e t h a t t h e n o d e s

D 1 a n d D2 m i g h t r e p r e s e n t c o m p l i c a t e d s t r u c t u r e s a n d

t h a t t h e s y m m e t r i c c o m b i n a t i o n s o f W 2 p o i n t i n g t o

W 1 a r e p o s s i b l e . F o r m a l l y , i f

W 1 = ( D i , E i , F i ) a n d W 2 = ( D 2 , E 2 , F 2 )

t h e n

W3

w h e r e

= ( D i ( J D 2 , E i ~ 7 E 2 ,F i ( ] F 2 £ T F i 2 )

Fi2: (DitT E I) + D 2

T w o s t r u c t u r e s w h i c h a r e f r e q u e n t l y u s e d f o r

i n f o r m a t i o n r e t r i e v a l s y s t e ms , i n d e x e d s e q u e n t i a l

a n d a o n e - w a y l i s t o f o n e - w a y l i s t s , c a n b e e a s i l y

r e p r e s e n t e d i n g r a p h t h e o r e ti c t e r m s . A n i n d e x e d

s e q u e n t i a l f i l e h a s t w o e n t r y n o d e s , o n e t o t h e i n -

d e x a n d o n e t o t h e f i l e, a n d t w o t y p e s o f d a t a n o d e s ;

i n d e x n o d e s a n d r e c o r d n o d es . W e h a v e a s s u m e d t h a t

e a c h i n d e x b r a n c h r e f e r e n c e s t h e b e g i n n i n g o f

• t r i n g s o f e q u a l l e n g t h ( i n t h i s c a s e 3 ) . T h e

g r a p h a n d t h e g r a p h t h e o r e t i c n o t a t i o n t o d e s c r i b e

i t a r e :

* * * F i g u r e 1 5 " * *

A s a m o r e c o m p l e x e x a m p l e , l e t u s c o n s i d e r t h e

G R I P H O S s y s t e m; a n i n f o r m a t i o n r e t r i e v a l s y s t e m

w h i c h d e a l s w i t h s e t s o f t a g g e d s t r i n g s . T h e d a t a

n o d e s a r e o r d e r e d p a i r s r e f e r r e d t o a s f i e l d s . C o n -

s i d e r a t a g

T = { t o ] O = 1 . . . # T }

a n d a s t r i n g t a k e n f r o m t h e s et :

s = { s ~ l ~ = 1 . . . # s } I

W e d e f i n e a f i e l d a s a n o r d e r e d p a i r < t , s > o f

t h e s e t T X S. I n a g i v e n d a t a b a s e t h e s e t o f a l l

f i e l d s w i l l b e :

F = { f o ] o = i . . . # F } ~ T x S

A r e c o r d i n t h e G R I P H O S s y s t e m i s a s e t o f f i e l d s :

r = { f I ~ = l . . . # r }

a n d t h e d a t a b a s e i s v i e w e d a s a s e t o f r e c o r d s .

T h e r e c o r d s a r e o r g a n i z e d b y t h e i n p u t p r o g r a m

s o t h a t e a c h r e c o r d c a n b e s e a r c h e d f o r t h e f i e l d si t c o n t a i n s o r f o r t h e n e x t r e c o r d e n t e r e d i n t o

t h e d a t a b a s e . W h e n r e c o r d s a r e e n t e r e d i n t o t h a t

d a t a b a s e p o i n t e r s a r e e n t e r e d s o t h a t f i e l d s c a n

b e a d d e d t o a n y r e c o r d a t a f u t u r e t i m e w i t h a

m i n i m a l a m o u n t o f s e a r c h i n g . I f w e d e s i g n a t e t h e

~ t h i n p u t r e c o r d a s r i c o n t a i n i n g f i e l d s f i g a n d a

d u m m y r e c o r d r 0 c o n t a i n i n g a t o p a n d b o t t o m p o i n t e r ,

t h e o r g a n i z e d r e c o r d s h a v e t h e m a p p i n g F :

F r 0 = { r l , r n }

F r i = { r i + l , f i l , f i # r " } i < n1

F r n = { f n l , f n # r }n

F f i ~ = { f i o + l } ~ < # r i

F f i # r . =1

* * * F i g u r e 1 6 " * *

I t is p o s s i b l e t o s e a r c h o u t e a c h f i e l d a n d

t e l l w h i c h r e c o r d c o n t a i n s a g i v e n f i e l d b y s e -

q u e n t i a l l y s e a r c h i n g f o r th e n e x t r e c o r d a n d t h e n

s e q u e n t i a l l y s e a r c h i n g f o r t h e n e x t f i e l d . S i n c e

t h i s m o d e o f r e t r i e v a l i s v e r y t i m e c o n s u m i n g , t h e

G R I P H O S s y s t e m s u p p o r t s s e a r c h s t r a t e g i e s b a s e d o n

i n v e r t e d f i l e s . T h e i n v e r t e d f i l e s a r e b a s e d o n a

h a s h i n g f u n c t i o n f o r a l l f i e l d s w i t h a g i v e n t a g .

W e f o r m a p a r t i t i o n o f t h e s e t of f i e l d s F b y

t a g t i E T :

F i = { f i o l t i e f i ~ , ~ = l . . . # F } i = l . . . # T

T h e h a s h i n g f u n c t i o n h ( f) f u r t h e r s u b d i v i d e s t h e

s e t o f f i e l d s F b y p a r t i t i o n i n g t h e s e t F i :

F.13 = f i j ~ I t i g f i j O ' h ( f i j O ) = j ' O = l ' ' ' # F i j ~ j = l ' ' "

# h ( f i j ~ )

A s s o c i a t e d w i t h e v e r y f i e l d f ~ 4 ~ E F i4 , t h e r e i s aJ

s e t o f i n t e g e r s ~ i J _ ~ j { l . . . # r ~ o f w ~ i c h e a c h e l e -

4 0

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 6/9

PJ

F I G U R E 1 3

P

F I G U R F 1 4

\

F I G U R E 1 5 a

4 1

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 7/9

h "

i

/ [

q

Y L ~ ,

. ~ d : l

i

FIGURE 15b

P

F I G U R E 16

42

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 8/9

m e n t c o r r e s p o n d s t o a r e c o r d c o n t a i n i n g a f i e ld w i t h

a t a g t i w h o s e h a s h v a l u e i s j:

~ i j = { £ o l t i e f i j o , h ( f i j o ) = J , f E r £ ,e

o = l . . . # F i j , 0 = l . . . # ~ i j }

T h e a b o v e p a r t i t i o n i n g o f t h e f i e l d s i s u s e d

b y t h e G R I P H O S s y s t e m t o f o r m a " t r e e s e a r c h a b l e "

i n d e x t o t h e r e c o r d s { r i } of t h e d a t a b a s e . T h e

e n t r y n o d e s t o t h e i n d e x p o r t i o n o f t h e d a t a b a s e

i s t h a t s e t of t a g s { t o } ~ T f o r w h i c h a u s e r c o n -s t r u c t s a n i n d e x . T h e m a p p i n g F w h i c h s p e c i -

f i e s t h e f i l e o r g a n i z a t i o n i s g i v e n b y :

F t i = { f i j l l t i ~ f i J l ' h ( f i j l ) = j }

Ffij 1 { fiJ 2' f iJ #FiJ' ~ i }

F f i j o = { f i j o + l , £ I l < ° < # F i j

F f i j # F i j = { £ 1 }

F £ 1 = { ~ o + l , r £ o } l < £ o < # ~ i j

F Z # ~ i j = { r ~ # ~ i j }

* * * F i g u r e 1 7 " * *

T h e G R I P H O S s y s t e m h a s a d a t a b a s e o r g a n i z a -

t i o n w h i c h s u p p o r t s s e l e c t i v e s e a r c h i n g f o r r e c o r d s

c o n t a i n i n g a g i v e n f i e l d o r s u b s e t o f f i e l d s a n d

t h e n a c o m p l e t e s e a r c h o f t h e r e c o r d .

T h i s p a p e r i s a n i n t r o d u c t i o n t o th e g r a p h

t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s . T h e f o l l o w -

i n g i d e a s w i l l b e m o r e f o r m a l l y d e v e l o p e d i n u p -

c o m i n g r e p o r t s :

i ) B y a f f i x i n g a n u m e r i c a l v a l u e t o e a c h o f

t h e e d g e s w e c a n s t u d y t h e p r o p e r t i e s o f p a r t i c u -

l a r i m p l e m e n t a t i o n s . T h e v a l u e s r e p r e s e n t t h e

t i m e n e c e s s a r y t o t r a v e r s e t h a t b r a n c h . T h u s t h e

e f f i c i e n c y o f v a r i o u s o r g a n i z a t i o n s a n d i n d e x e s

c a n b e C o m p a r e d .

2 ) T h e t o p o l o g y o f a g r a p h c a n b e s t u d i e s

i n d e p e n d e n t o f a n y i n t e r p r e t a t i o n i n t h e s a m e

w a y t h a t f l o w c h a r t s c h e m a t a a r e s t u d i e d . W e

a r e i n t e r e s t e d i n c o n s i d e r i n g t e a c h a b i l i t y ,

c o n n e c t i v i t y a n d c y c l i c i t y . T h e l e n g t h , d i a -

m e t e r a n d o t h e r m e t r i c s a r e u s e d t o d e s c r i b e

v a r i o u s g r a p h s . T h e n a n i n t e r p r e t a t i o n o f t h e

g r a p h c a n b e m a d e b y a s s u m i n g t h a t e a c h n o d e

h a s i n f o r m a t i o n w h i c h i n f l u e n c e s o u r s e a r c h

t e c h n i q u e s . F o r e x a m p l e , w e c a n d i s t i n g u i s h

b e t w e e n t h e p r o p e r t i e s o f a s e a r c h o n a n o r -

d e r e d l i s t a n d a n u n o r d e r e d l i st .

3 ) T h e p o s s i b i l i t y o f u s i n g " c o l o r e d "

b r a n c h e s f u r t h e r e n h a n c e s t h e r i c h n e s s o f

s t r u c t u r e . A s i n g l e m a y c o n t a i n s e v e r a l

s t r u c t u r e s e a c h o f w h i c h c a n b e v i s u a l i z e d

a s h a v i n g d i f f e r e n t c o l o r e d b r a n c h e s . T h i s

f u r t h e r d e l i n e a t e s t h e n a t u r e o f s t r u c t u r ea n d r e q u i r e s a r e d e f i n i t i o n o f s o m e o f th e p r o p e r -

t i e s o f s u c h s t r u c t u r e s .

4 ) B y a s s i g n i n g v a l u e s t o e a c h n o d e , r e f l e c t -

i n g t h e p r o b a b i l i t i e s o f e a c h n o d e b e i n g a c c e s s e d ,

w e c a n m o r e c l o s e l y d e f i n e o p t i m u m o r g a n i z a t i o n s .

5 ) M o s t i n t e r e s t i n g o f a l l , a r e t h e p r o p e r -

t i e s o f d y n a m i c g r a p h s , t h a t i s, g r a p h s w h i c h

c h a n g e w i t h t i me . W e a re i n t e r e s t e d i n s t u d y i n g

o p e r a t i o n s o f a d d i t i o n , d e l e t i o n a n d c o m b i n a t i o n

o f W F L S s a n d h o w t h e s e o p e r a t i o n s o f a d d i t i o n , d e -

l e t i o n a n d c o m b i n a t i o n o f W F L S s a n d h o w t h e s e

o p e r a t i o n s a f f e c t p r o p e r t i e s o f t h e g r a p h . T h e r e

i s v e r y l i t t l e w o r k i n g r a p h t h e o r y o n g r a p h t r a n s -

f o r m a t i o n s , m o s t o f t h e e f f o r t h a s b e e n d e v o t e d t o

d e s c r i b i n g t h e p r o p e r t i e s o f a n a l r e a d y e x i s t i n g

g r a p h . W e w o u l d l i k e to d e s c r i b e t e c h n i q u e s f o r

c r e a t i n g a g r a p h s o t h a t i t h a s c e r t a i n p r o p e r t i e s ,

s u c h a s a m a x i m u m s e a r c h l e n g t h o r f r e e d o m f r o m

c y c l e s .

B I B L I O G R A P H Y

i . C h i l d s , D . C . F e a s i b i l i t y o f a s e t - t h e o r e t i c d a t a

s t r u c t u r e . P r o c . I F I P C o n g r e s s 1 9 6 8 , V o l . i ,

N o r t h H o l l a n d P u b . C o . , A m s t e r d a m , p p . 4 2 0 - 4 3 0 .

2. Schwar tz, J. Set theory as a langu age for pro-

g r a m s p e c i f i c a t i o n a n d p r o g r a m m in g . N e w Y o r k

U n i v e r s i t y , 1 9 7 0 .

3 . C o d d , E . F . A r e l a t i o n a l m o d e l o f d a t a f o r l a r g e

s h a r e d d a t a b a n k s , C o m m , A C M 1 3 , 6 ( J u n e 1 9 7 0 ) ,

3 7 7 - 3 8 7 .

4 . H s i a o , D . a n d H a r a r y , F . A F o r m a l S y s t e m f o r

I n f o r m a t i o n R e t r i e v a l f r o m F i l e s . C o m m . A C M 1 3 ,

2 (February 1970), pp. 67-73.

5 . E a r l e y , J . T o w a r d a n U n d e r s t a n d i n g o f D a t a

S t r u c t u r e s . C o m m . A C M 14 , i 0 ( O c t o b e r 1 97 1 ) ,

pp. 617-627.

43

8/3/2019 A g r a p h t h e o r e t i c m o d e l o f d a t a s t r u c t u r e s

http://slidepdf.com/reader/full/a-g-r-a-p-h-t-h-e-o-r-e-t-i-c-m-o-d-e-l-o-f-d-a-t-a-s-t-r-u-c-t-u-r-e-s 9/9

O

O B

F I G U R E 1 7

44