Last active
November 7, 2020 15:04
-
-
Save davibarreira/543051ec2fff89b3469c819b3b3e77c2 to your computer and use it in GitHub Desktop.
Adding edges to graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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