I need to generate a graph using integer arrays. Edges of the graphs are kept as edges[e][2] where e is the number of edges. I need my graph to be connected, i.e. you should be able to traverse from all nodes to all nodes.
edges[0] = {0,5} means an edge connects node 0 and node 5. Could you suggest an algorithm, please?
And please keep in mind that i will generate graphs with millions of nodes, so that it is better if algorithm complexity isn't too high.