Utilities — suffix-tree 0.1.1 documentation

# Utilities

Utilities for suffix tree.

DEBUG = False

  Print lots of debug information.

DEBUG_DOT = False

  Write out dot files of the tree at the end of each phase.

DEBUG_LABELS = False

  Include more (potentially confusing) information in node labels.

class UniqueEndChar(id_)

  A singleton object to signal end of sequence.

  __init__(id_)
  __str__()

    Return str(self).

min_debug_depth = -1

  How deep we were in the stack when emitting the first debug message.

  Used to print the interesting part of the stack.

debug(msg: str, *args, **kwargs) → None

  Print a debug message to stderr.

is_debug() → bool

  Return True if debugging is on.

ukko_str(S: Sequence[Hashable], start: int, end: int) → str

  Debug path in Ukkonen’s preferred notation.

class Path(S, start=0, end=None)

  A path in a suffix tree.

  __init__(S, start=0, end=None)

    Initialize a path from a sequence of symbols.

    If end is None it is set to the length of the sequence.

  __str__() → str

    Return str(self).

  __lt__(other) → bool

    Return True if self less than other.

    Convenience function that allows to sort paths if the symbols are sortable. Not used in tree construction.

  __getitem__(i: int) → Hashable

    Return the symol at position i.

    Note: this should implement slices but we don’t need them. Also we don’t need negative indices.