trustgraph

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package trustGraph is based on EigenTrust http://nlp.stanford.edu/pubs/eigentrust.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Certainty float32
	Max       int
	Alpha     float32
	// contains filtered or unexported fields
}

Group represents a group of peers. Peers need to be given unique, int IDs. Certainty represents the threshold of RMS change at which the algorithm will escape. Max is the maximum number of loos the algorithm will perform before escaping (regardless of certainty). These default to 0.001 and 200 respectivly and generally don't need to be changed.

func NewGroup

func NewGroup() Group

NewGroup is the constructor for Group.

func (Group) Add

func (g Group) Add(truster, trusted int, amount float32) (err error)

Add will add or override a trust relationship. The first arg is the peer who is extending trust, the second arg is the peer being trusted (by the peer in the first arg). The 3rd arg is the amount of trust, which must be

func (Group) Compute

func (g Group) Compute() map[int]float32

Compute will approximate the trustworthyness of each peer from the information known of how much peers trust eachother. It wil loop, upto g.Max times or until the average difference between iterations is less than g.Certainty.

func (Group) InitialTrust

func (g Group) InitialTrust(trusted int, amount float32) (err error)

InitialTrust sets the vaulues used to seed the calculation as well as the corrective factor used by Alpha.

Jump to

Keyboard shortcuts

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