Java - Which is the best implementation structure for Graph?

前端 未结 8 2102
我在风中等你
我在风中等你 2021-02-02 16:47

The graph is very large but undirected. Edges are unweighted.

In my implementation, I have to find the vertex with max degree and do deletion on both vertexes and edges.

8条回答
  •  长发绾君心
    2021-02-02 17:09

    The two fundamental data structures for representing graphs are the

    • adjacency list

    • the adjacency matrix

    see http://en.wikipedia.org/wiki/Adjacency_list and http://en.wikipedia.org/wiki/Adjacency_matrix.
    The articles also discuss the pros and cons of those two structures.

提交回复
热议问题