Three ways to store a graph in memory, advantages and disadvantages

后端 未结 7 1740
别跟我提以往
别跟我提以往 2020-12-04 07:09

There are three ways to store a graph in memory:

  1. Nodes as objects and edges as pointers
  2. A matrix containing all edge weights between numbered node x a
7条回答
  •  被撕碎了的回忆
    2020-12-04 07:47

    Take a look at comparison table on wikipedia. It gives a pretty good understanding of when to use each representation of graphs.

提交回复
热议问题