noderank

package
v0.0.0-...-e899ace Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pagerank implements the *weighted* PageRank algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRank

func GetRank(request *GetRankRequest, period int, numRank int) ([]Teescore, []Teectx, error)

func PrintHCGraph

func PrintHCGraph(request *GetRankRequest, period string) error

PrintHCGraph 辅助方法,用来打印结果

Types

type GetRankRequest

type GetRankRequest struct {
	Blocks   string `json:"blocks"`
	Duration int    `json:"duration"`
}

type Graph

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

Graph holds node and edge data.

func NewGraph

func NewGraph() *Graph

NewGraph initializes and returns a new graph.

func (self *Graph) Link(source, target string, weight float64)

Link creates a weighted edge between a source-target node pair. If the edge already exists, the weight is incremented.

func (*Graph) Rank

func (self *Graph) Rank(α, ε float64, callback func(id string, rank float64))

Rank computes the PageRank of every node in the directed graph. α (alpha) is the damping factor, usually set to 0.85. ε (epsilon) is the convergence criteria, usually set to a tiny value.

This method will run as many iterations as needed, until the graph converges.

func (*Graph) Reset

func (self *Graph) Reset()

Reset clears all the current graph data.

type TeeSoreSlice

type TeeSoreSlice []Teescore

TeeSoreSlice ...

func (TeeSoreSlice) Len

func (t TeeSoreSlice) Len() int

Len ...

func (TeeSoreSlice) Less

func (t TeeSoreSlice) Less(i, j int) bool

Less ...

func (TeeSoreSlice) Swap

func (t TeeSoreSlice) Swap(i, j int)

Swap ...

type Teectx

type Teectx struct {
	Attester string `json:"Attester"`
	Attestee string `json:"Attestee"`
	Score    string `json:"Score"`
}

type Teescore

type Teescore struct {
	Attestee string  `json:"Attestee"`
	Score    float64 `json:"Score"`
}

Jump to

Keyboard shortcuts

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