Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues running bi.clique #14

Open
anieto25 opened this issue May 26, 2022 · 0 comments
Open

Issues running bi.clique #14

anieto25 opened this issue May 26, 2022 · 0 comments

Comments

@anieto25
Copy link

Hi!

I have a problem using bi.clique function. I ran the function in my original network (I called it df_x), and it works well. However, after randomly rewiring the network using the function rg_reshuffling_tm (tnet package) and adjusting the resulting edge list using the bi.format() function, it does not. I get the following message: Error in seq.default(1, nelems - 9, 3) : wrong sign in 'by' argument.

This function works well in the original network, and I can't spot any differences in the files that I am using, so I am unsure what is causing this error. Any clues on what might be causing this error? Thank you for taking the time to look into this!

A copy of my code is here and I am also attaching the original edge list (df_x).

#df_x contains the original network

#Assign a unique code to each event
events <- select (df_x, V2) %>% unique () %>% mutate (i = 1:29437)

#Assign a unique code to each individual
individuals <- select (df_x, id_person) %>% unique () %>% mutate (p = 29438:(29437+64041))


# join df's using the newly assigned codes
df_joined_events <- left_join(df_x, events)
df_joined_total <- left_join(df_joined_events, individuals) %>% select (i, p)


# create the net object that aligns with tnet's requirements
net <- as.tnet(df_joined_total)

# randomly rewire the original network 5 times and get the number of bicliques

#create empty df i=iterations and bicliques = number of maximal bicliques
df_simulations <- tibble (i = NA, bicliques = NA)

for (i in 1:5){

# rewire the network at random 
net_simulated <- rg_reshuffling_tm(net, option="links") %>% as.tibble()

## write the tsv file 
write.table(net_simulated, file ='net_simulated.tsv', sep = "\t" ,col.names = F, row.names = F)

## include information required by the biclique package
bi.format('net_simulated.tsv')

## run the bi.clique on the rewired version of the network)
net_bicliques <- bi.clique('net_simulated.tsv', left_least = 2, right_least = 2)

## get the number of bicliques 
bicliques <- length (net_bicliques)

## create df with the results 
df_loop <- tibble (i = i, bicliques = bicliques)

## bind the results to df_simulations
df_simulations <- rbind (df_simulations, df_loop)
}

df_x.csv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant