Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to store graph in adjacency matrix

I am creating a graph with the help of adjacency matrix, how can I store the values in the matrix? do I need to change the size of the body with each insertion of the node?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If the number of nodes are not fixed then use an adjacency list instead of a matrix. if you want to use the adjacency matrix firstly scan all the inputs and find the distinct N nodes, after that you can create NxN matrix to store the results. in this way you need to scan the list twice firstly to get the distinct nodes and then the vslues.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading