in_edges(g::AbstractGraph, v::Int) = [Edge(x,v) for x in badj(g,v)]
in_edges(g::AbstractGraph, v::Int) = map(x->Edge(x,v), badj(g,v))julia> function f1(g,a)
         [Pair(x,g) for x in a]
       end
f1 (generic function with 1 method)
julia> function f2(g,a)
         map(x->Pair(x,g), a)
       end
f2 (generic function with 1 method)
julia> @time f1(2,ones(1_000_000));
  25.158 milliseconds (28491 allocations: 24736 KB, 12.69% gc time)
julia> @time f1(2,ones(1_000_000));
   6.866 milliseconds (8 allocations: 23438 KB, 37.10% gc time)
julia> @time f1(2,ones(1_000_000));
   6.126 milliseconds (8 allocations: 23438 KB, 25.99% gc time)
julia> @time f2(2,ones(1_000_000));
 684.994 milliseconds (2057 k allocations: 72842 KB, 1.72% gc time)
julia> @time f2(2,ones(1_000_000));
 647.267 milliseconds (2000 k allocations: 70313 KB, 3.64% gc time)
julia> @time f2(2,ones(1_000_000));
 633.149 milliseconds (2000 k allocations: 70313 KB, 0.91% gc time)julia> function f3(g,a)
         pairit(x) = Pair(x,g)
         map(pairit, a)
       end
f3 (generic function with 1 method)
julia> @time f3(2,ones(1_000_000));
 108.542 milliseconds (2082 k allocations: 73928 KB, 13.02% gc time)
julia> @time f3(2,ones(1_000_000));
  58.142 milliseconds (2000 k allocations: 70313 KB, 42.84% gc time)
julia> @time f3(2,ones(1_000_000));
  39.441 milliseconds (2000 k allocations: 70313 KB, 12.40% gc time)