Version: v0.2.5 Latest Latest

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

Go to latest
Published: Jul 3, 2021 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Graph

type Graph struct {
	Nodes []Node

Graph represents a graph of integers numbered from 0 to n - 1.

func FromForestArray

func FromForestArray(forest []int) (*Graph, int, bool)

FromForestArray creates a Graph from array representation of a forest f[i] represents the father of i, if f[i] != i

func FromForestArrayI32

func FromForestArrayI32(forest []int32) (*Graph, int, bool)

func New

func New(n int) *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(i, j int)

func (*Graph) Debug

func (g *Graph) Debug()

func (*Graph) DebugString

func (g *Graph) DebugString() string

func (*Graph) DigestBytes

func (g *Graph) DigestBytes() []byte

func (Graph) IsIsolated

func (g Graph) IsIsolated(i int) bool

func (Graph) IsSelfLoop

func (g Graph) IsSelfLoop(i int) bool

func (Graph) Nexts

func (g Graph) Nexts(i int) []int

func (Graph) Prevs

func (g Graph) Prevs(i int) []int

func (Graph) Reverse

func (g Graph) Reverse() *Graph

type Node

type Node struct {
	Rank     int
	SelfLoop bool
	Prevs    Vertices
	Nexts    Vertices

type Vertices

type Vertices []int

func (*Vertices) Append

func (vs *Vertices) Append(v int)

Source Files

Jump to

Keyboard shortcuts

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