0
I have query related to graph .
Now a days i am learning graph . I also got the concept but struggling with the different represention in different platforms and YouTube . That represention are : (1) vector <int> adj [n+1] (2) unordered_map<int , list<int>> adj (3) int adj [n+1][m+1] (4) vector<pair<int , int>> & edges (5) vector<int> adj [ ] Because of this solution also change . May you please tell me how to convert one from another . Or any other good technique, it will help me a lot . Thank you .
1 ответ
+ 1
You can represent a graph as an adjacency matrix (technically a 2d array) or an adjacency list. Both versions can be valid, and even in programming you can use different ways (array, vector, custom object) to build it. Just choose one that you are most comfortable with...
https://www.sololearn.com/learn/656/?ref=app