complicated

package
v0.0.0-...-e19c9e5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EQ  = 10000
	GT  = 10001
	LT  = 10002
	QS  = 10003
	INF = math.MaxInt
)
View Source
const (
	Less   = 1  // is considered to be ascending
	Equal  = 0  // is considered to be equal
	Larger = -1 // is considered to be descending

	Inc    = true
	Reduce = false
)
View Source
const (
	DefaultIsBiDirectional = true

	Epsilon     = "epsilon"
	EdgeEpsilon = "epsilon"
	EdgeBlank   = "epsilon"
)

Variables

This section is empty.

Functions

func Comp

func Comp(compedValue, compValue interface{}) int

func IntType

func IntType(value interface{}) bool

func IntValueComp

func IntValueComp(compValue, compedValue int) int

func TestInternal

func TestInternal()

func TypeForcedTransfer

func TypeForcedTransfer(value interface{}) string

Types

type AdjGraph

type AdjGraph struct {
	Nodes    []*GraphNode
	Adjacent map[GraphNode][]*GraphNode
	Edges    []*GraphEdge

	IsUnidirectional bool
	// contains filtered or unexported fields
}

AdjGraph 如何记录一个点到另一个点的边value edge(i--k-->j) Nodes nodeIndex from [0,N-1] Edges edgeIndex from [0,M-1]

func (*AdjGraph) AddEdge

func (graph *AdjGraph) AddEdge(nodeI, nodeJ *GraphNode, edge *GraphEdge)

AddEdge (i--k-->j)

func (*AdjGraph) AddNode

func (graph *AdjGraph) AddNode(node *GraphNode)

AddNode i nodeIndex = n-1 node.i = n

func (*AdjGraph) Amount

func (graph *AdjGraph) Amount() (int, int)

func (*AdjGraph) BfsGraph

func (graph *AdjGraph) BfsGraph() []interface{}

func (*AdjGraph) CalculateDiffValueEdge

func (graph *AdjGraph) CalculateDiffValueEdge() *MySet

CalculateDiffValueEdge 不带空边

func (*AdjGraph) CalculateDiffValueNode

func (graph *AdjGraph) CalculateDiffValueNode() *MySet

func (*AdjGraph) ConnectedComponents

func (graph *AdjGraph) ConnectedComponents() int

ConnectedComponents calculate graph Connectivity if 1 is connected else not

func (*AdjGraph) Construct

func (graph *AdjGraph) Construct(isUnidirectional bool)

func (*AdjGraph) DfsGraph

func (graph *AdjGraph) DfsGraph() []interface{}

DfsGraph NonRecursion dfs

func (*AdjGraph) EdgeValueString

func (graph *AdjGraph) EdgeValueString() string

func (*AdjGraph) ExistEdge

func (graph *AdjGraph) ExistEdge(i, j int, cEdge *GraphEdge) (int, int, int)

ExistEdge 存在相同的边 边的i,j传不进来 导致无法调用ei,ej,ek

func (*AdjGraph) ExistEdgeValue

func (graph *AdjGraph) ExistEdgeValue(cEdge *GraphEdge) bool

func (*AdjGraph) ExistNodeValue

func (graph *AdjGraph) ExistNodeValue(cNode *GraphNode) int

ExistNodeValue 存在相同值的节点

func (*AdjGraph) FlushSelfToClearMemory

func (graph *AdjGraph) FlushSelfToClearMemory()

func (*AdjGraph) IsIsolatedNode

func (graph *AdjGraph) IsIsolatedNode(nodeValue interface{})

IsIsolatedNode ensure graph isolatedNode the graph that one node owns only one different value else meaningless

func (*AdjGraph) NodeIToNodeIndex

func (graph *AdjGraph) NodeIToNodeIndex(i int) int

NodeIToNodeIndex nodeIndex=graph.Nodes[nodeIndex].i 求nodeIndex 通过node.i 求出 nodeIndex

func (*AdjGraph) PrintNodes

func (graph *AdjGraph) PrintNodes(tAddress []interface{})

func (*AdjGraph) StartWithIndexEdge

func (graph *AdjGraph) StartWithIndexEdge(nodeIndex int, a interface{}) *MySet

func (*AdjGraph) TestINodeIndex

func (graph *AdjGraph) TestINodeIndex()

func (*AdjGraph) WalkFromNodeI

func (graph *AdjGraph) WalkFromNodeI(i int, edgeValue interface{}) *MySet

func (*AdjGraph) WalkFromNodeIOnlyEpsilon

func (graph *AdjGraph) WalkFromNodeIOnlyEpsilon(i int) *MySet

type AvlTree

type AvlTree struct {
	NodeAmount int      // Tree Total Node Counts, NodeAmount
	AvlRoot    *avlNode // Root of Tree, AvlRoot
}

func (*AvlTree) BfsAvl

func (avl *AvlTree) BfsAvl() []interface{}

func (*AvlTree) Delete

func (avl *AvlTree) Delete(value interface{})

func (*AvlTree) DfsAvl

func (avl *AvlTree) DfsAvl() []interface{}

DfsAvl midOrder arr in sequence

func (*AvlTree) Insert

func (avl *AvlTree) Insert(value interface{})

type BList

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

func PopBack

func PopBack(list *BList) (*BList, interface{})

func PopFront

func PopFront(list *BList) (*BList, interface{})

func PushBack

func PushBack(list *BList, value interface{}) *BList

func PushFront

func PushFront(list *BList, value interface{}) *BList

func (*BList) ForwardTraversal

func (list *BList) ForwardTraversal()

func (*BList) IsEmpty

func (list *BList) IsEmpty() bool

func (*BList) OppositeTraversal

func (list *BList) OppositeTraversal()

type GraphEdge

type GraphEdge struct {
	Value interface{}
	// contains filtered or unexported fields
}

GraphEdge Value&&i&&j&&k

func (*GraphEdge) AssignIJ

func (edge *GraphEdge) AssignIJ(_i, _j, _k int)

func (*GraphEdge) String

func (edge *GraphEdge) String() string

type GraphNode

type GraphNode struct {
	Value interface{}
	// contains filtered or unexported fields
}

GraphNode equal Value&&i

func (*GraphNode) AssignI

func (node *GraphNode) AssignI(_i int)

func (*GraphNode) String

func (node *GraphNode) String() string

type MySet

type MySet struct {
	ImmutableMap map[interface{}]bool
}

func SliceToSet

func SliceToSet(dataSlice []interface{}) *MySet

func (*MySet) Construct

func (set *MySet) Construct()

func (*MySet) DeepExist

func (set *MySet) DeepExist(value interface{}) bool

func (*MySet) Diff

func (set *MySet) Diff(cSet *MySet) *MySet

Diff 差集

func (*MySet) Equal

func (set *MySet) Equal(cSet *MySet) bool

func (*MySet) Erase

func (set *MySet) Erase(value interface{})

func (*MySet) EraseAll

func (set *MySet) EraseAll()

func (*MySet) Exist

func (set *MySet) Exist(value interface{}) bool

func (*MySet) Insert

func (set *MySet) Insert(value interface{})

func (*MySet) KleeneClosure

func (set *MySet) KleeneClosure(n int) *MySet

KleeneClosure 在PositiveClosure加一个空边即可

func (*MySet) Len

func (set *MySet) Len() int

func (*MySet) PositiveClosure

func (set *MySet) PositiveClosure(n int) *MySet

PositiveClosure 因为没有边界所以需要约束N

func (*MySet) Power

func (set *MySet) Power(n int) *MySet

func (*MySet) Product

func (set *MySet) Product(cSet *MySet) *MySet

Multiple 乘积

func (*MySet) Slice

func (set *MySet) Slice() []interface{}

func (*MySet) SliceBatchInsert

func (set *MySet) SliceBatchInsert(slice []interface{})

func (*MySet) SortSetToSlice

func (set *MySet) SortSetToSlice() []interface{}

func (*MySet) String

func (set *MySet) String() string

func (*MySet) Union

func (set *MySet) Union(cSet *MySet) *MySet

Union 交集

func (*MySet) Unite

func (set *MySet) Unite(cSet *MySet) *MySet

Unite 并集

Jump to

Keyboard shortcuts

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