treemap

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollapseLongPaths

func CollapseLongPaths(ctx context.Context, t *Tree)

CollapseLongPaths will collapse all long chains in tree.

func CollapseLongPathsFromNode

func CollapseLongPathsFromNode(ctx context.Context, t *Tree, nodeName string)

CollapseLongPathsFromNode will collapse current node into children as long as it has single child. Will set name of this node to joined path from roots. Will set size and heat to this child's size and heat. Expecting Name containing either single value for current node.

func SetNamesFromPaths

func SetNamesFromPaths(ctx context.Context, t *Tree)

SetNamesFromPaths will update each node to its path leaf as name.

Types

type Node

type Node struct {
	Path    string
	Name    string
	Size    float64
	Heat    float64
	HasHeat bool
}

type SumSizeImputer

type SumSizeImputer struct {
	EmptyLeafSize float64
}

SumSizeImputer will set sum of children into empty parents and fill children with contant.

func (SumSizeImputer) ImputeSize

func (s SumSizeImputer) ImputeSize(ctx context.Context, t Tree)

func (SumSizeImputer) ImputeSizeNode

func (s SumSizeImputer) ImputeSizeNode(ctx context.Context, t Tree, node string)

type Tree

type Tree struct {
	Nodes map[string]Node
	To    map[string][]string
	Root  string
}

func (Tree) HasHeat

func (t Tree) HasHeat(ctx context.Context) bool

func (Tree) HeatRange

func (t Tree) HeatRange(ctx context.Context) (minHeat float64, maxHeat float64)

func (Tree) NormalizeHeat

func (t Tree) NormalizeHeat(ctx context.Context)

type WeightedHeatImputer

type WeightedHeatImputer struct {
	EmptyLeafHeat float64
}

WeightedHeatImputer will make color of parent to weighted sum of colors of its children.

func (WeightedHeatImputer) ImputeHeat

func (s WeightedHeatImputer) ImputeHeat(ctx context.Context, t Tree)

func (WeightedHeatImputer) ImputeHeatNode

func (s WeightedHeatImputer) ImputeHeatNode(ctx context.Context, t Tree, node string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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