Broadcasting and the function keyword arguments

In the lieu of the fact that the broadcast is faster than the dot syntax

I would like to replace the following code snippet

using Graphs

n = 10
p = 0.1:0.01:0.5

erdos_renyi.(n,p;is_directed=true, seed=-1)

which correctly generates 11 directed E-R-Gilbert graphs with the broadcast function.

This works


but defaults to the undirected graphs. How do I use keyword arguments with the broadcast function?


Somebody already asked this question on the stackoverflow. I took a clue from one of the accepted answer and got what I wanted.

broadcast((x,y) -> erdos_renyi(x,y;is_directed=true, seed=-1),n,p)
1 Like

Can you mark it as “solved”?

(FYI, the thread you’ve linked does not really show that broadcast is faster.)


No, it isn’t, and that thread shows they are the same. It’s a benchmarking issue. Just use dot.