global_temporal_three_node_motif#
- global_temporal_three_node_motif(graph, delta, threads=None)#
Computes the number of three edge, up-to-three node delta-temporal motifs in the graph, using the algorithm of Paranjape et al, Motifs in Temporal Networks (2017). We point the reader to this reference for more information on the algorithm and background, but provide a short summary below.
Motifs included:
Stars
There are three classes (in the order they are outputted) of star motif on three nodes based on the switching behaviour of the edges between the two leaf nodes.
PRE: Stars of the form i<->j, i<->j, i<->k (ie two interactions with leaf j followed by one with leaf k)
MID: Stars of the form i<->j, i<->k, i<->j (ie switching interactions from leaf j to leaf k, back to j again)
POST: Stars of the form i<->j, i<->k, i<->k (ie one interaction with leaf j followed by two with leaf k)
Within each of these classes is 8 motifs depending on the direction of the first to the last edge – incoming “I” or outgoing “O”. These are enumerated in the order III, IIO, IOI, IOO, OII, OIO, OOI, OOO (like binary with “I”-0 and “O”-1).
Two node motifs:
Also included are two node motifs, of which there are 8 when counted from the perspective of each node. These are characterised by the direction of each edge, enumerated in the above order. Note that for the global graph counts, each motif is counted in both directions (a single III motif for one node is an OOO motif for the other node).
Triangles:
There are 8 triangle motifs:
i –> j, k –> j, i –> k
i –> j, k –> j, k –> i
i –> j, j –> k, i –> k
i –> j, j –> k, k –> i
i –> j, k –> i, j –> k
i –> j, k –> i, k –> j
i –> j, i –> k, j –> k
i –> j, i –> k, k –> j
- Parameters:
graph (GraphView) – A directed raphtory graph
delta (int) – Maximum time difference between the first and last edge of the motif. NB if time for edges was given as a UNIX epoch, this should be given in seconds, otherwise milliseconds should be used (if edge times were given as string)
threads (int, optional) – The number of threads to use when running the algorithm.
- Returns:
A 40 dimensional array with the counts of each motif, given in the same order as described above. Note that the two-node motif counts are symmetrical so it may be more useful just to consider the first four elements.
- Return type:
Notes
This is achieved by calling the local motif counting algorithm, summing the resulting arrays and dealing with overcounted motifs: the triangles (by dividing each motif count by three) and two-node motifs (dividing by two).