I’m using python igraph to find the motifs and vertices invovled in a directed and weighted graph with the method motifs_randesu
.
How do I get a list of all associated vertices for each motif?
Let’s say for example: motif: 0->1 2->0 1->2, maybe eligible vertices are:[(0, 2, 3), (3, 5, 6)]
Or maybe i can get the motifs from a given vertex?
Let’s say for example: i have a vertex, all the motif counts of this vertex can be obtained
Thank you so much!
I think this functionality is not currently exposed in Python (correct me if I’m wrong, @tamas). However, it is possible with the C library, see igraph Reference Manual. It could be exposed in Python if there is demand.
What is your specific use case? For example, in the Mathematica interface of igraph I have IGMotifsVertexParticipation
, which gives motif counts per vertex.
Thanks a lot!
I found that callback
parameter of method motifs_randesu
can give me the node lists of each type motif.
Here’s the case i need, and i already fix it!
def motif_callback(graph, node_list, motif):
print(f'Motif found: {motif} with nodes {node_list}')
motif_counts = g.motifs_randesu(size=3, callback = motif_callback)
I’m sorry, so indeed it is exposed in Python. I kept looking for a separate function with the callback functionality.