Skip to content

Commit

Permalink
tree_decomposition.pyx: Change K_{1, 4} to claw in label_nice_tree_de…
Browse files Browse the repository at this point in the history
…composition test
  • Loading branch information
guojing0 committed Dec 13, 2023
1 parent fadce49 commit 157c801
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions src/sage/graphs/graph_decompositions/tree_decomposition.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1083,37 +1083,31 @@ def label_nice_tree_decomposition(nice_TD, root, directed=False):
EXAMPLES::
sage: from sage.graphs.graph_decompositions.tree_decomposition import make_nice_tree_decomposition, label_nice_tree_decomposition
sage: bip_one_four = graphs.CompleteBipartiteGraph(1, 4)
sage: bip_one_four_TD = bip_one_four.treewidth(certificate=True)
sage: nice_TD = make_nice_tree_decomposition(bip_one_four, bip_one_four_TD)
sage: claw = graphs.CompleteBipartiteGraph(1, 3)
sage: claw_TD = claw.treewidth(certificate=True)
sage: nice_TD = make_nice_tree_decomposition(claw, claw_TD)
sage: root = sorted(nice_TD.vertices())[0]
sage: label_TD = label_nice_tree_decomposition(nice_TD, root, directed=True)
sage: print(label_TD.name())
Labelled Nice tree decomposition of Tree decomposition
sage: label_TD.name()
'Labelled Nice tree decomposition of Tree decomposition'
sage: for node in sorted(label_TD):
....: print(node, label_TD.get_vertex(node))
(0, {}) forget
(1, {0}) forget
(2, {0, 1}) intro
(3, {0}) forget
(4, {0, 4}) join
(5, {0, 4}) intro
(6, {0, 4}) intro
(7, {0}) forget
(8, {0}) forget
(9, {0, 3}) intro
(10, {0, 2}) intro
(11, {3}) intro
(12, {2}) intro
(13, {}) leaf
(14, {}) leaf
(4, {0, 3}) intro
(5, {0}) forget
(6, {0, 2}) intro
(7, {2}) intro
(8, {}) leaf
"""
from sage.graphs.digraph import DiGraph
from sage.graphs.graph import Graph

directed_TD = DiGraph(nice_TD.breadth_first_search(start=root, edges=True),
format='list_of_edges',
name='Labelled {}'.format(nice_TD))
name='Labelled {}'.format(nice_TD.name()))

# The loop starts from the root node
# We assume the tree decomposition is valid and nice,
Expand Down

0 comments on commit 157c801

Please sign in to comment.