Documentation ¶
Index ¶
- Variables
- type MultiRootTree
- func (t *MultiRootTree) AddNode(node *TreeNode)
- func (t *MultiRootTree) AddNodeIfNotExist(node *TreeNode)
- func (t *MultiRootTree) GetNodeByName(dagName string) (*TreeNode, bool)
- func (t *MultiRootTree) GetRootNodes() []*TreeNode
- func (t *MultiRootTree) MarkRoot(node *TreeNode)
- func (t *MultiRootTree) ValidateCyclic() ([]string, error)
- type TreeData
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
var ErrCyclicDependencyEncountered = errors.New("a cycle dependency encountered in the tree")
ErrCyclicDependencyEncountered is triggered a tree has a cyclic dependency
Functions ¶
This section is empty.
Types ¶
type MultiRootTree ¶
type MultiRootTree struct {
// contains filtered or unexported fields
}
MultiRootTree - represents a data type which has multiple independent root nodes all root nodes have their independent tree based on depdencies of TreeNode. it also maintains a map of nodes for faster lookups and managing node data.
func NewMultiRootTree ¶
func NewMultiRootTree() *MultiRootTree
NewMultiRootTree returns an instance of multi root dag tree
func (*MultiRootTree) AddNode ¶
func (t *MultiRootTree) AddNode(node *TreeNode)
func (*MultiRootTree) AddNodeIfNotExist ¶
func (t *MultiRootTree) AddNodeIfNotExist(node *TreeNode)
func (*MultiRootTree) GetNodeByName ¶
func (t *MultiRootTree) GetNodeByName(dagName string) (*TreeNode, bool)
func (*MultiRootTree) GetRootNodes ¶
func (t *MultiRootTree) GetRootNodes() []*TreeNode
func (*MultiRootTree) MarkRoot ¶
func (t *MultiRootTree) MarkRoot(node *TreeNode)
MarkRoot marks a node as root
func (*MultiRootTree) ValidateCyclic ¶
func (t *MultiRootTree) ValidateCyclic() ([]string, error)
ValidateCyclic - detects if there are any cycles in the tree
type TreeNode ¶
TreeNode represents a custom data type that contains data along with it's dependent TreeNodes
func NewTreeNode ¶
NewTreeNode creates an instance of TreeNode
func (*TreeNode) AddDependent ¶
func (*TreeNode) GetAllNodes ¶
GetAllNodes returns level order traversal of tree starting from current node