Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to seed/randomize the find_subgraph function #243

Open
kevinchern opened this issue Feb 20, 2024 · 3 comments
Open

Need to seed/randomize the find_subgraph function #243

kevinchern opened this issue Feb 20, 2024 · 3 comments

Comments

@kevinchern
Copy link
Contributor

kevinchern commented Feb 20, 2024

I cannot randomize nor fix the seed used in minorminer.subgraph.find_subgraph
find_subgraph(subgraph, big_graph, value_ordering='random') always gives the same result

@kevinchern kevinchern changed the title Need to seed the find_subgraph function Need to seed/randomize the find_subgraph function Feb 20, 2024
@jackraymond
Copy link
Contributor

A workaround you might try is to perform a graph automorphism or relabeling of the graph.
Another guaranteed workaround is to break the source graph with respect to subgraphs you don't want to see (removing any subset of the edges or nodes [from a known subgraph] from the graph will force an alternative subgraph). This can be generalized to a branch and bound method to enumerate all cases (albeit inefficiently in most applications).

I agree, would be useful to have option to randomize, or to have a generator of unique subgraphs, built in.

@kevinchern
Copy link
Contributor Author

kevinchern commented Feb 22, 2024

relabeling of the graph.

there's a slight problem with this approach (pointed out to me by @boothby), because the variable names are changed but the node list order is the same. Node list order is used in the find_subgraph method. So another workaround is to recreate a graph by randomizing the node order.

@jackraymond
Copy link
Contributor

Yes, you need to regenerate the graph with permuted edge order (and/or permuted node order). It was pointed out to be me by @arcondello that subgraph is a function only of the edge order though, so node order only matters in so far as it impacts edge order. There is a related [pathological case] bug (that isolated nodes are ignored by find_subgraph). #254

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants