Hello,

I have a question about the Property maps returned by clustering.motif().

Practically, I have the following graph:

pprint(rlf)

<Graph object, directed, with 22312 vertices and 44849 edges at 0x1007a3650>

In this graph, vertex and edge have some properties. For example :

rlf.vertex_properties

{'status': <PropertyMap object with key type 'Vertex' and value type 'string', for Graph 0x1007a3650, at 0x1007a36d0>, '_graphml_vertex_id': <PropertyMap object with key type 'Vertex' and value type 'string', for Graph 0x1007a3650, at 0x101057c10>, 'name': <PropertyMap object with key type 'Vertex' and value type 'string', for Graph 0x1007a3650, at 0x1007ac750>}

Note that this graph occupies the memory space 0x1007a3650.

I've asked to graph-tool the motifs of this graph, with the following instruction:

motifs, counts, vertex_maps = gt.clustering.motifs(gt.GraphView(rlf, directed=False), 4, return_maps=True)

So far, so good. This instruction returned me 3 variables. The first one is a list of graphs (motifs), the second one a list of numbers of counts, but the third is a bit mysterious for me.

So, it's a list of list of Property maps and it's ok that every one of this map correspond with a count of motif. However, I expected that this property maps refer to my original graph, but it does not.

For example, if I'm looking for the first motif and the first map :

pprint(motifs[0])

<Graph object, undirected, with 4 vertices and 3 edges at 0x1007778d0>

case0 = vertex_maps[0]

graph0 = case0[0]

pprint(graph0)

<PropertyMap object with key type 'Vertex' and value type 'int32_t', for Graph 0x1007778d0, at 0x10a2db7d0>

The first PropertyMap object refer to the motif and not to my original graph. And here, I don't understand. For a motif which occurs 10 times in my graph, I obtain 10 property maps. If I use get_graph on this 10 maps, I obtain 10 identical graphs. What would be the value of returning the maps? I had hoped to obtain sub-graph with original vertex and edges properties.

Is it something that I didn't understand? Is it possible to obtain sub-graph with original vertex and edges properties by using clustering.motifs?

Best regards,

Sandrine

attachment.html (2.61 KB)