12.07.2015 Views

Tamtam Proceedings - lamsin

Tamtam Proceedings - lamsin

Tamtam Proceedings - lamsin

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

592 Hlaoui3. The New Graph RepresentationThis section presents the new graph representation, the adjacency list-matrix, whichcombines the advantages of the classical representations while avoiding their drawbacksand fully capturing the graph information. Our presentation begins by giving an idea ofthe expected result of the new graph representation. Mechanisms and tools for buildingthe adjacency list-matrix will also be described. Finally, a simple example is given toshow the behaviour of the new matrix for the graph G shown in Fig.1.The main advantage of the adjacency matrix and successor (resp. predecessor) list istheir ability to provide quicker answers to certain questions, requiring only O(1) step. Unfortunately,most of these questions need one step for one representation and many moresteps for the other. Our aim is to find a new representation which provides a straightforwardaccess to the information and needs only O(1) step to answer most questions. Forexample, to check whether a vertex v i has a loop, it is only necessary to read a single cellof the adjacency matrix(i.e. O(1)), while in the case of the successor (resp. predecessor)lists O(|SL i |) (resp. O(|P L i |)) cells have to be read in the worst case. Thus, an improvedgraph representation combines the advantages of the adjacency matrix and the successor(resp. predecessor) lists. In building such a representation, we should strive to capture thesimple, flexible information access afforded by the adjacency matrix as well as the contiguousrepresentation of the adjacent vertices of a vertex vi given by the successor (resp.predecessor) lists.Our new graph representation is an n × n integer matrix (R = r ij ). Each cell in the Rmatrix contains useful and rich information to give the user full and concise informationconcerning the corresponding vertex. The use of cells with Boolean values in the case ofthe adjacency matrix is a naive strategy to meet user needs for "complicated" questions.However, checking one cell in the R matrix should still be sufficient to give the bestanswer in a short time. The contiguity property will be discussed later. A Boolean cell atthe intersection of row i and column j gives us only an idea concerning the existence ofan edge between the vertices v i and v j . When i = j, the cell also shows the existence of aloop. By making element r ij more expressive and meaningful than a Boolean value, othertypes of information are introduced.If row i in the adjacency matrix has no element equal to 1, it means that the correspondingvertex v i is not connected to any vertex in the graph. To check for non-connectivitywe need O(n) steps in the worst case. In contrast, this task needs one step in the adjacencylist case. To preserve the time efficiency of the adjacency lists, we set the first cell in rowi to 1. Thus, to check the non-connectivity of a vertex v i , we need only check whetherthe first cell in the corresponding row is equal to 1. In order to keep a consistent strategyfor the cell, as in the adjacency matrix, we replace the edge-existence test for vertices v iand v 1 by r ij ≤ 2 instead of the traditional r ij = 0 each time we need to check the edgeexistenceproperty. This condition is also used to check for loop existence when i = j.The previous operation reveals whether a vertex has no successors we are dealing withrows. For the predecessor case, we set the first cell in column i, rather than row i to 1.TAMTAM –Tunis– 2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!