util

package
v0.0.0-...-c564278 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 13 Imported by: 4

Documentation

Overview

Copyright ©2015 The Gonum Authors. All rights reserved. Use of this code is governed by a BSD-style license that can be found in the LICENSE file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogSeed

func LogSeed(round, activated int, roundtime, timetotal float64, seeds set.Set, config *Config, bufferedWriter *bufio.Writer)

func SeedToLog

func SeedToLog(round, activated int, roundtime float64, seeds set.Set) (s string)

Types

type Algorithm

type Algorithm int
const (
	CELF Algorithm = iota
	TIM
	MAX_DEGREE
	DISCOUNT_DEGREE
	PMC
)

func ToAlgorithm

func ToAlgorithm(a string) Algorithm

func (Algorithm) String

func (a Algorithm) String() string

type Config

type Config struct {
	OutputDir   string `toml:"outputDir"`
	GraphPath   string `toml:"graphPath"`
	Trials      int    `toml:"trials"`
	Algorithm   string `toml:"algorithm"`
	Seeds       int    `toml:"seeds"`
	Model       string `toml:"model"`
	Simulations int    `toml:"simulations"`
	Seed        int64  `toml:"seed"`
}

This is the base Config type for the API. Extend as needed.

func LoadConfig

func LoadConfig(filename string) (*Config, error)

func (*Config) LogFileName

func (c *Config) LogFileName() (s string)

type DiffusionModel

type DiffusionModel int
const (
	IC DiffusionModel = iota
	LT
)

func ToDiffusionModel

func ToDiffusionModel(a string) DiffusionModel

func (DiffusionModel) String

func (a DiffusionModel) String() string

type Edge

type Edge struct {
	Src    Node
	Target Node
	Dist   float64
}

type Graph

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

func NewGraph

func NewGraph(graphFilePath string) (g *Graph, err error)

func (*Graph) Neighbors

func (g *Graph) Neighbors(node Node, inv bool) []Edge

func (*Graph) Nodes

func (g *Graph) Nodes() set.Set

func (*Graph) NumEdges

func (g *Graph) NumEdges() int

func (*Graph) SampleLivingEdge

func (g *Graph) SampleLivingEdge(node Node, src grand.Source) int

type Item

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

func (*Item) Value

func (i *Item) Value() interface{}

type Node

type Node int

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue(cmpFunc func(interface{}, interface{}) bool) *PriorityQueue

func (*PriorityQueue) Len

func (pq *PriorityQueue) Len() int

func (*PriorityQueue) Peek

func (pq *PriorityQueue) Peek() interface{}

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{}) *Item

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(item *Item, value interface{})

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Len

func (q *Queue) Len() int

func (*Queue) Peek

func (q *Queue) Peek() interface{}

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(entry interface{})

type Stack

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

func NewStack

func NewStack() *Stack

Create a new stack

func (*Stack) Len

func (s *Stack) Len() int

Return the number of items in the stack

func (*Stack) Peek

func (s *Stack) Peek() interface{}

View the top item on the stack

func (*Stack) Pop

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

Pop the top item of the stack and return it

func (*Stack) Push

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

Push a value onto the top of the stack

type TrialType

type TrialType struct {
	Source Node
	Target Node
	Trial  int
}

type Weighted

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

func NewWeighted

func NewWeighted(w []float64) Weighted

func (Weighted) Len

func (s Weighted) Len() int

func (Weighted) Reweight

func (s Weighted) Reweight(idx int, w float64)

func (Weighted) Take

func (s Weighted) Take(src grand.Source) (idx int, ok bool)

Take returns an index from the Weighted with probability proportional to the weight of the item. The weight of the item is then set to zero. Take returns false if there are no items remaining.

Jump to

Keyboard shortcuts

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