graph

package
v0.0.0-...-da378b8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package graph creates a ItemGraph data structure for the Item type

Package graph creates a NodeQueue data structure for the Node type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item generic.Type

Item the type of the binary search tree

type ItemGraph

type ItemGraph struct {
	// contains filtered or unexported fields
}

ItemGraph the Items graph

func (*ItemGraph) AddEdge

func (g *ItemGraph) AddEdge(n1, n2 *Node)

AddEdge adds an edge to the graph

func (*ItemGraph) AddNode

func (g *ItemGraph) AddNode(n *Node)

AddNode adds a node to the graph

func (*ItemGraph) String

func (g *ItemGraph) String()

AddEdge adds an edge to the graph

func (*ItemGraph) Traverse

func (g *ItemGraph) Traverse(f func(*Node))

Traverse implements the BFS traversing algorithm

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node a single node that composes the tree

func (*Node) String

func (n *Node) String() string

type NodeQueue

type NodeQueue struct {
	// contains filtered or unexported fields
}

NodeQueue the queue of Nodes

func (*NodeQueue) Dequeue

func (s *NodeQueue) Dequeue() *Node

Dequeue removes an Node from the start of the queue

func (*NodeQueue) Enqueue

func (s *NodeQueue) Enqueue(t Node)

Enqueue adds an Node to the end of the queue

func (*NodeQueue) Front

func (s *NodeQueue) Front() *Node

Front returns the item next in the queue, without removing it

func (*NodeQueue) IsEmpty

func (s *NodeQueue) IsEmpty() bool

IsEmpty returns true if the queue is empty

func (*NodeQueue) New

func (s *NodeQueue) New() *NodeQueue

New creates a new NodeQueue

func (*NodeQueue) Size

func (s *NodeQueue) Size() int

Size returns the number of Nodes in the queue

Jump to

Keyboard shortcuts

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