If you are given a list containing information (i.e. each entry is a pair: (pair of nodes and an edge labeling)). How would go about constructing a undirected graph from the list and is it possible to achieve an O(m + n) running time, respective to the edges and vertices?
I guess the real question is what data structure would be most efficient, but is it still possible to achieve the desired linear running time starting from a list.
(Note: I'm not experienced at all with coding graphs/trees)