graph icon indicating copy to clipboard operation
graph copied to clipboard

vf2_sub_graph_iso.hpp: fix bug when subgraph is filtered

Open count0 opened this issue 3 years ago • 5 comments

This fixes a bug when num_vertices() returns a value that does not match the actual number of vertices. This happens for instances of filtered_graph<>.

The fix involves looping over the graph to count the actual number of vertices. The performance overhead is negligible.

count0 avatar Jan 02 '22 15:01 count0

Thanks for contributing a fix. Could I ask you to please also add a small unit test that demonstrates the new functionality? (I.e. the test should fail without your changes.)

I don't know the details of this algorithm -- do we only have to check if one graph is filtered, and not the other one?

jeremy-murphy avatar Jan 03 '22 23:01 jeremy-murphy

I don't know the details of this algorithm -- do we only have to check if one graph is filtered, and not the other one?

Both graphs can be potentially be filtered, but I think the PR covers it. The check in success() is for whether all the vertices in the "small" graph has been mapped, and with the initial vertex count checks that is enough.

jakobandersen avatar Jan 04 '22 08:01 jakobandersen

Thanks for contributing a fix. Could I ask you to please also add a small unit test that demonstrates the new functionality? (I.e. the test should fail without your changes.)

This problem has been noticed in graph-tool (which is built on top of BGL), for which there is a simple example where the code fails: https://git.skewed.de/count0/graph-tool/-/issues/715

If necessary I could translate it to a minimal C++ code.

count0 avatar Jan 04 '22 08:01 count0

If necessary I could translate it to a minimal C++ code.

Yes, please, that is what I would like.

The develop branch appears to be green now, so we can actually merge this when it's done.

jeremy-murphy avatar Feb 07 '22 23:02 jeremy-murphy

@count0 do you have time to address the issues I commented on and add the unit test?

jeremy-murphy avatar Mar 02 '22 15:03 jeremy-murphy