Skip to content

Instantly share code, notes, and snippets.

@davibarreira
Last active November 7, 2020 15:04
Show Gist options
  • Save davibarreira/543051ec2fff89b3469c819b3b3e77c2 to your computer and use it in GitHub Desktop.
Save davibarreira/543051ec2fff89b3469c819b3b3e77c2 to your computer and use it in GitHub Desktop.
Adding edges to graph
ew = Int[]
for i in 1:ncol(df), j in i+1:ncol(df) # iterate over all combinations of columns
w = dot(df[!, i], df[!, j]) # calculate how many times (i,j) occurs
if w > 0
push!(ew, w)
add_edge!(g, i, j, w)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment