|
-
January 26th, 2010, 02:43 AM
#1
Adjacency Matrix Representation
In an adjacency matrix for an undirected graph ,almost half the storage space required by the graph is unnecessary (the have 0 value).
please suggest a modification that uses less space
Regards
Harsh Jain
-
January 26th, 2010, 09:46 AM
#2
Re: Adjacency Matrix Representation
You mean that the array in principle consists of two triangles, one above the diagonal and one below the diagonal, and that they essentially hold the same information?
Then you can organize the matrix as an array of arrays. If the inner-most arrays have different lengths this is called a jagged matrix. In your case the inner-most arrays will have increasing lengths starting at 1, like
*
* *
* * *
* * * *
etcetera.
Just make sure the first index is bigger than the second when you access it, otherwise you need to swap them first.
Last edited by nuzzle; January 26th, 2010 at 12:39 PM.
-
January 27th, 2010, 06:01 AM
#3
Re: Adjacency Matrix Representation
 Originally Posted by harsh4u8
In an adjacency matrix for an undirected graph ,almost half the storage space required by the graph is unnecessary (the have 0 value).
please suggest a modification that uses less space
Regards
Harsh Jain
My mothod is the same as yours at present
-
January 28th, 2010, 08:59 AM
#4
Re: Adjacency Matrix Representation
Implement it as a list. If you maintain an Adjacency Matrix, you can never get rid of the redundant entries.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|