tree

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTree

func PrintTree(root *Node, syms TreeBranchSymbols, out io.Writer, maxDepth uint)

Types

type Node

type Node struct {
	Nodes []*Node
	Value string
}

func NewTree

func NewTree(root string) *Node

func (*Node) Add

func (r *Node) Add(node *Node) error

func (*Node) AddValue

func (r *Node) AddValue(value string) (*Node, error)

func (*Node) GetNodeByValueBFS

func (r *Node) GetNodeByValueBFS(value string, maxDepth int) *Node

func (*Node) GetNodeByValueDFS

func (r *Node) GetNodeByValueDFS(value string) *Node

DFS implementation

type TreeBranchSymbols

type TreeBranchSymbols struct {
	Branch     string
	LastBranch string
	Vertical   string
	Space      string
}
var DefaultTreeBranchSymbols TreeBranchSymbols = TreeBranchSymbols{
	Branch:     "├── ",
	LastBranch: "└── ",
	Vertical:   "│   ",
	Space:      "    ",
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL