Java - Which is the best implementation structure for Graph?

前端 未结 8 2104
我在风中等你
我在风中等你 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 16:58

    From the above suggested the answer would be

    Map with LinkedList...

    Your datastructure could be like this(varies according to your requirement)...

    Map>
    
    

    Basically, Graphs are best implemented with the help of HASHING and the above datastructure helps a lot in that..

提交回复
热议问题