# Temporal Motif Counting (Old)

Returns the number of 2-edge temporal motifs for every node in the graph.

The algorithms identifies 2-edge-1-node temporal motifs; It detects two types of motifs:

Type-1: Detects motifs that exhibit incoming flow followed by outgoing flow in the form;

Type-2: Detects attribute-based motifs that exhibit a non-negative balance while maintaining the temporal pattern of Type-1 i.e. on average, a larger incoming weight is followed by a lesser outgoing weight in the form;

### Parameters

• top (Int) – The number of nodes with highest number of motifs to return. (Default: 0) If not specified, Raphtory will return the motif count of all nodes that observe the motifs.
• weight (String) – Edge property (Default: "weight"). To be specified for type-2 motifs.
• delta (Long) – The size of the window in time to search for motifs where the length of the motif must be < delta.

### Returns

• total (Int) – Number of nodes that exhibit a temporal motif.
• motifs (Map) – A dictionary of average number of motifs for Type-1 and Type-2 per node.

## Examples

Given the data table below, a temporal graph spanning three time periods can be constructed.

timesourcetargetweight
1122
1131
1233
2127
3135
3233
3349

Running the algorithm on the temporal network at $t=3$ with a $\delta = 3$;

curl -X POST 127.0.0.1:8081/ViewAnalysisRequest \
-H "Content-Type: application/json" \
--data-binary @- << EOF
{
"jsonrpc":"2.0",
"analyserName":"com.raphtory.algorithms.MotifCounting",
"serialiserName":"com.raphtory.serialisers.DefaultSerialiser",
"timestamp":3,
"args":["0", "weight", "3"]
}
EOF


Returns two nodes that observe temporal motifs of type T-1/T-2:

{"time":3,"total": 2, "motifs":{ "2":{"mc1":0.4, "mc2":1.0},"3":{"mc1":0.3333333333333333, "mc2":0.0} },"viewTime":10168}


Tags: