goNetwork

package module
v0.0.0-...-4eecb66 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2015 License: MIT Imports: 2 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Graph Toys

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Node_src  *Node
	Node_dest *Node
	Weight    float64
	Key       string
}

func (*Edge) Print

func (edge *Edge) Print()

type Element

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

type Graph

type Graph struct {
	Edges []*Edge
	Nodes []*Node
}

func (*Graph) AddNode

func (g *Graph) AddNode(data interface{}) *Node

func (*Graph) Connect

func (graph *Graph) Connect(node_src *Node, node_dest *Node, weight float64, key string)

func (*Graph) Dfs

func (g *Graph) Dfs(start *Node) SizedArray

func (*Graph) DfsPath

func (g *Graph) DfsPath(start *Node, goal *Node) (SizedArray, error)

type Node

type Node struct {
	Data  interface{}
	Edges []*Edge
}

func (*Node) Connections

func (node *Node) Connections() []*Node

TODO handle direction, rename to connections

func (*Node) GetDest

func (node *Node) GetDest(edge *Edge) *Node

This is not directed Would need to use parent Graph object to handle a graph type system

func (*Node) Print

func (node *Node) Print(edges bool, adjacent bool)

type OrderedMap

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

func (*OrderedMap) Iter

func (o *OrderedMap) Iter() <-chan struct{ Key, Val interface{} }

func (*OrderedMap) Set

func (o *OrderedMap) Set(key interface{}, val interface{})

type SizedArray

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

func MakeSizedArray

func MakeSizedArray(size int32) SizedArray

func (*SizedArray) Last

func (sa *SizedArray) Last() interface{}

returns the last item in the array

func (*SizedArray) PushBack

func (sa *SizedArray) PushBack(item interface{})

pushes the item onto the array at the back

type Stack

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

func (*Stack) Len

func (s *Stack) Len() int

Return the stack's length

func (*Stack) Pop

func (s *Stack) Pop() (value interface{})

Remove the top element from the stack and return it's value If the stack is empty, return nil

func (*Stack) Push

func (s *Stack) Push(value interface{})

Push a new element onto the stack

type Visitor

type Visitor struct {
	Visited    visitMap
	VisitOrder SizedArray
}

The goal of this object is to keep track of things while searching etc happens

func MakeVisitor

func MakeVisitor(size int) *Visitor

func (*Visitor) Visit

func (v *Visitor) Visit(i *Node) bool

Mark item as visited and add to visit order unless this item has already been visited returns bool indicating whether this has already been visited

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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