Skip to content

Subgraph isomorphism can't find a trivial isomorphism if the filtering GraphViews are used

Subgraph isomorphism can't find a trivial isomorphism if the filtering GraphViews are used.

The code below creates two one-vertex views of the same graph, using the same filter. subgraph_isomorphism can't see the similarity.

from graph_tool import Graph, GraphView
from graph_tool.topology import subgraph_isomorphism
g=Graph(directed=True)
v1=g.add_vertex()
v2=g.add_vertex()
v3=g.add_vertex()
g.add_edge(v1,v2)
g.add_edge(v2,v3)

flt=lambda x:x!=1   # <---- This doesn't work, but the line below does.
# flt=lambda x:True 
a=GraphView(g,vfilt=flt)
b=GraphView(g,vfilt=flt)
print(subgraph_isomorphism(a,b))
print('Graph_tool version', graph_tool.__version__)

outputs

[]
Graph_tool version 2.43 (commit , )

A possibly related issue is #2 (closed)

Edited by Sergey M