Skip to content
Snippets Groups Projects
Commit 1270e50c authored by Radek Hušek's avatar Radek Hušek
Browse files

misc.graph_to_gadget: allow gadgets of non-zero size

parent c6614ea0
No related branches found
No related tags found
No related merge requests found
...@@ -42,9 +42,12 @@ def _init_(): ...@@ -42,9 +42,12 @@ def _init_():
return (b.eval(CircuitDoubleCover), 2**(G.num_verts() // 2) // 2) return (b.eval(CircuitDoubleCover), 2**(G.num_verts() // 2) // 2)
def graph_to_gadget(G, decomposition = None): def graph_to_gadget(G, decomposition = None, allow_non_graph = False):
"""Transform graph into a Gadget. """Transform graph into a Gadget.
If allow_non_graph is True, allow transforming a part of the
graph into a gadget of non-zero size.
EXAMPLES: EXAMPLES:
>>> from sage.all import * >>> from sage.all import *
>>> from .parameters import CircuitDoubleCover, UnderlayingGraph >>> from .parameters import CircuitDoubleCover, UnderlayingGraph
...@@ -106,7 +109,7 @@ def _init_(): ...@@ -106,7 +109,7 @@ def _init_():
return (Gadget.join([ g for g, _ in gadgets ], joins, outs), gadget_verts) return (Gadget.join([ g for g, _ in gadgets ], joins, outs), gadget_verts)
b, _ = process(decomposition) b, _ = process(decomposition)
assert b.is_graph() assert allow_non_graph or b.is_graph()
return b return b
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment