graph

package
v0.0.0-...-4496321 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Graph types
	DOUBLE_BUTTERFLY          = "double_butterfly"
	LINEAR_SUPER_CONCENTRATOR = "linear_super_concentrator"
	STACKED_EXPANDERS         = "stacked_expanders"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DoubleButterfly

type DoubleButterfly struct {
	*Graph
}

func (*DoubleButterfly) IsGraphType

func (_ *DoubleButterfly) IsGraphType() string

type Graph

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

func ConstructDoubleButterfly

func ConstructDoubleButterfly(id int, g, l int64) *Graph

Double Butterfly graph

func ConstructLinearSuperConcentrator

func ConstructLinearSuperConcentrator(id int, n, k, d int64, localize bool) *Graph

func ConstructStackedExpanders

func ConstructStackedExpanders(id int, n, k, d int64, localize bool) *Graph

func DefaultDoubleButterfly

func DefaultDoubleButterfly(id int) *Graph

func DefaultLinearSuperConcentrator

func DefaultLinearSuperConcentrator(id int) *Graph

func DefaultStackedExpanders

func DefaultStackedExpanders(id int) *Graph

func NewGraph

func NewGraph(id int, size int64, _type string) *Graph

func (*Graph) Get

func (g *Graph) Get(idx int64) *Node

Get node

func (*Graph) GetParents

func (g *Graph) GetParents(idx int64) Int64s

func (*Graph) Print

func (g *Graph) Print()

func (*Graph) SetType

func (g *Graph) SetType(impl GraphType) bool

func (*Graph) SetValues

func (g *Graph) SetValues(pub crypto.PubKeyEd25519)

func (*Graph) Size

func (g *Graph) Size() int64

type GraphType

type GraphType interface {
	IsGraphType() string
}

type LinearSuperConcentrator

type LinearSuperConcentrator struct {
	*Graph
}

func (*LinearSuperConcentrator) Concentrator

func (sup *LinearSuperConcentrator) Concentrator(m, n, d int64, localize, reverse bool)

A left expander output will have d incoming edges from inputs and one incoming edge from a leftover node in the concentrator. A right expander output will have d incoming edges from inputs and one incoming edge from the perfect matching..

func (*LinearSuperConcentrator) IsGraphType

func (_ *LinearSuperConcentrator) IsGraphType() string

func (*LinearSuperConcentrator) PinskerExpander

func (sup *LinearSuperConcentrator) PinskerExpander(m, n, d int64, localize bool)

Bipartite Expander

type Node

type Node struct {
	Idx     int64  `json:"idx"`
	Parents Int64s `json:"parents"`
	Value   []byte `json:"value"`
}

func NewNode

func NewNode(idx int64) *Node

func (*Node) AddParent

func (nd *Node) AddParent(parent int64) bool

func (*Node) MarshalBinary

func (nd *Node) MarshalBinary() ([]byte, error)

func (*Node) NoParents

func (nd *Node) NoParents() bool

func (*Node) String

func (nd *Node) String() string

func (*Node) UnmarshalBinary

func (nd *Node) UnmarshalBinary(data []byte) error

type Nodelist

type Nodelist []*Node

func (Nodelist) Len

func (lst Nodelist) Len() int

func (Nodelist) Less

func (lst Nodelist) Less(i, j int) bool

func (Nodelist) Size

func (lst Nodelist) Size() int64

func (Nodelist) Swap

func (lst Nodelist) Swap(i, j int)

type StackedExpanders

type StackedExpanders struct {
	*Graph
}

func (*StackedExpanders) ChungExpander

func (stacked *StackedExpanders) ChungExpander(m, n, d int64)

This implements Chung's randomized construction of a bipartite expander Each source has d outgoing edges and each sink has d incoming edges. We establish a one-to-one matching between sources and sinks by iterating through the sources and randomly selecting a sink for each. If the chosen sink already has a parent, we search outwards until we find an available sink. Once we have the random permutation, we add d-1 more incoming edges to each sink. These edges come from the d-1 sources immediately after the matching source (we loop around if we reach m+2*n) TODO: add localization transformation TODO: more explicit panic messages

func (*StackedExpanders) IsGraphType

func (_ *StackedExpanders) IsGraphType() string

func (*StackedExpanders) PinskerExpander

func (stacked *StackedExpanders) PinskerExpander(m, n, d int64, localize bool)

This implements Pinsker's randomized construction of a bipartite expander. We iterate through the sinks and randomly choose d predecessors for each. The localization transformation works as follows... each edge from source i to sink j where (i mod n) < (j mod n) is replaced by an edge from sink k to sink j where (i mod n) == (k mod n). After the randomized construction, any edge from source i to sink j where (i mod n) == (j mod n) that does not already exist is added to the graph..

Jump to

Keyboard shortcuts

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