MarsMDK / NuMeTriS

NuMeTriS is a package developed on python3 for Pattern Detection of the 13 triadic connected sub-graphs using maximum-entropy models using direected and reciprocated constraints on network data.
GNU General Public License v3.0
2 stars 0 forks source link

Symmetry in triadic counts #1

Open LeonardoIalongo opened 1 month ago

LeonardoIalongo commented 1 month ago

I noticed that the counts you algorithm returns do not take into consideration the symmetry of the pattern, such that the same triad (i,j,k) can be counted multiple times according to the number of permutation symmetry of the traid. As an example consider the first motif (the V-shaped), which has one edge from i to j and one edge from i to k, but no edge from j to k and not reciprocated links. From the point of view of the triples (i,j,k), we note that also (i,k,j) will be admissible. I believe the code is double counting the triads in this sense.

LeonardoIalongo commented 1 month ago

Code to reproduce:

import numpy as np
from NuMeTriS import Graph

A = np.array([
    [0, 1, 1],
    [0, 0, 0],
    [0, 0, 0]
])

# Create graph object
G = Graph(adjacency=A)

print(G.Nm_emp)
# [2. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]