GRAPH best data structure

What is the best data structure to make graph in c++ having a lot more entries let say more than 10000,
is it HashMap???

Although my answer is not C+±specific:

It depends on what you want to achieve. There are many possible representations for graphs. And each representation has its own advantages and disadvantages regarding space complexity and complexity for operations (like adding vertices, looking up edges, etc.). Therefore, it really depends on the problem and which operations you need.

2 Likes