I’m sorry, I have to correct what I said above. The non-normalized “nominal” assortativity is actually the same as modularity, just as you show in your last post. So you can use `modularity`

in R/igraph.

```
> modularity(G, communities, weights=E(G)$weight, directed = T)
[1] 0.09876543
> modularity(G, communities, weights=E(G)$weight, directed = F)
[1] 0.07407407
```

The default calculation is directed for directed graphs, which is what you have here. So use `directed=F`

if you want undirected.

The assortativity implementation in C/igraph 0.10 which I mentioned does not actually support weights. So if you need weights, then you’d have to use `modularity()`

anyway.

Comparison with Mathematica and IGraph/M:

```
In[352]:=
edges = Partition[{1, 3, 2, 1, 3, 6, 4, 6, 1, 5, 5, 4, 6, 1}, 2];
In[353]:= weights = {0.1, 0.2, 0.2, 0.15, 0.3, 0.3, 0.1};
In[354]:= membership = {1, 1, 2, 2, 2, 2};
In[355]:=
g = Graph[Range[6], DirectedEdge @@@ edges, EdgeWeight -> weights];
In[356]:= communities = IGMembershipToPartitions[g, membership]
Out[356]= {{1, 2}, {3, 4, 5, 6}}
In[357]:= IGModularity[g, communities, DirectedEdges -> True]
Out[357]= 0.0987654
In[358]:= IGModularity[g, communities, DirectedEdges -> False]
Out[358]= 0.0740741
In[359]:= GraphAssortativity[g, communities, "Normalized" -> False]
Out[359]= 0.0987654
```