placed in list or some other data structure whatever structure is usedthis storage is for convenience only it has no relevance to how the vertices are connected by edges for thiswe need another mechanism edges in "red-black trees,we saw that computer program can represent trees in several ways mostly we examined trees in which each node contained references to its childrenbut we also mentioned that an array could be usedwith node' position in the array indicating its relationship to other nodes "heaps,described arrays used to represent kind of tree called heap graphhoweverdoesn' usually have the same kind of fixed organization as tree in binary treeeach node has maximum of two childrenbut in graph each vertex may be connected to an arbitrary number of other vertices for examplein figure -avertex is connected to three other verticeswhereas is connected to only one to model this sort of free-form organizationa different approach to representing edges is preferable to that used for trees two methods are commonly used for graphs:the adjacency matrix and the adjacency list (remember that one vertex is said to be adjacent to another if they're connected by single edge the adjacency matrix an adjacency matrix is two-dimensional array in which the elements indicate whether an edge is present between two vertices if graph has verticesthe adjacency matrix is an nxn array table shows the adjacency matrix for the graph in figure - table adjacency matrix the vertices are used as headings for both rows and columns an edge between two vertices is indicated by the absence of an edge is (you could also use boolean true/false values as you can seevertex is adjacent to all three other verticesb is adjacent to and dc is adjacent only to aand is adjacent to and in this examplethe "connectionof vertex to itself is indicated by so the diagonal from upper-left to lower-righta- to -dwhich is called the identity diagonalis all the entries on the identity diagonal don' convey any real informationso you can equally well put along itif that' more convenient in your program note that the triangular-shaped part of the matrix above the identity diagonal is mirror