ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2023 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Solutions.P92

Description

Some solutions to Problems.P92 of Ninety-Nine Haskell Problems.

Synopsis

Documentation

gracefulTree :: G -> Maybe (Map Vertex Int) Source #

Gracefully label a tree graph.

This implementation builds up a partial graceful labeling, adding one vertex at a time. It gives up and tries another if a partial labeling cannot be extended.

gracefulTree' :: G -> Maybe (Map Vertex Int) Source #

Gracefully label a tree graph.

This implementation tries all permutations of vertex labels and checks if any are a graceful labeling.