With the correct data dimensions I don't believe my original recommendation of Inner
is (easily) applicable. Further, Oleksandr revealed that it is not the fastest even in that case in later versions. Instead I'll just offer a few options and an observation:
list = RandomInteger[999, {2*^6, 2, 2}];
MapThread[Rule, Transpose[list]] // ByteCount
Rule @@@ list // ByteCount
Thread[Rule @@ Transpose[list]] // ByteCount
(list2 = list; list2[[All, 0]] = Rule; list2) // ByteCount
640000032
640000032
640000032
432000032
It can be seen that on my system the last method uses about a third less memory than the others. I don't yet know why. More memory can be conserved by this method, comparatively, if the original list may be modified in place:
list = RandomInteger[999, {2*^6, 2, 2}]; (* in a fresh Kernel *)
list = MapThread[Rule, Transpose[list]];
MaxMemoryUsed[]
1022926416
list = RandomInteger[999, {2*^6, 2, 2}];
list[[All, 0]] = Rule;
MaxMemoryUsed[]
350925448
We get by using about one third of the memory used by the original method.
If your code is failing because of memory consumption this may solve the problem.
edgelist
of the form{{{6, 6}, {7, 0}, {9, 1}, {7, 8}, {3, 6}}
or{{{6, 9}, {2, 1}}, {{7, 2}, {9, 5}}, {{8, 3}, {1, 1}}, {{4, 0}, {0, 1}}, {{9, 9}, {3, 6}}}
? $\endgroup$