Dyad census question

Hi folks,

I’d appreciate it if someone could offer some insights into my dyad census result. When I calculated dyad census on my data which included multiple repeated edges and self-loops. The first result contained negative numbers of null dyads but the pattern makes sense. Now I ran the analysis again and I got a different result and there were no more negative numbers. With or without removing multiple edges and self-loops, the result is the same.

I’ve copied my codes below. The two “dyad_census(g)” before and after simplying returned exactly the same result. I’d really appreciate it if I could have some help understanding this.

EL = read.csv("EL_G1.csv", header = TRUE
              , stringsAsFactors=FALSE)
NL = read.csv("NL_Gp1.csv", header = TRUE
              , stringsAsFactors=FALSE)
g <- graph_from_data_frame (d=EL, vertices=NL, directed=TRUE)

g <- graph_from_data_frame (d=EL, vertices=NL, directed=TRUE)


  remove.loops = TRUE,


I’m not sure what your question is. Can you please state it explicitly?

That should not happen. This may be integer overflow, which we should try to protect against. If you can reproduce this, please post a complete minimal example. See here for guidelines: How to create a Minimal, Reproducible Example - Help Center - Stack Overflow

The example should be short, but complete, i.e. you should either provide code to produce an example dataset, or share your actual dataset.

dyad_census() should treat graphs as simple, even without simplify(). If you ever see a difference between dyad_census(g) and dyad_census(simplify(g)), that would be a bug. Please report it along with a complete minimal example.

Thanks so much for this! My question wasn’t clear but I think you answered it. I was trying to understand why the null dyad values were negative before and not anymore. :slight_smile:

Just a follow-up question though: removing multiple edges seems to remove data as new exchanges between any two actors are ignored; I thought dyad census calculates all mutual ties even if they repeat since there’re new exchanges. The negative null dyad values seem to better describe the networks I’m studying. If I’d like to capture all mutual dyads including multiple edges between the two but excluding self-loops, would there be a way? Thank you!

Sorry I forgot to mention that the multiple edges are from different discussion forums but between the same two actors. Data were aggregated across discussions but within the same discussion group. Thanks for any thoughts.