pagerank: github.com/alixaxel/pagerank Index | Files

package pagerank

import "github.com/alixaxel/pagerank"

Package pagerank implements the *weighted* PageRank algorithm.

Index

Package Files

pagerank.go

type Graph Uses

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

Graph holds node and edge data.

func NewGraph Uses

func NewGraph() *Graph

NewGraph initializes and returns a new graph.

func (self *Graph) Link(source, target uint32, 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 Uses

func (self *Graph) Rank(α, ε float64, callback func(id uint32, 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 Uses

func (self *Graph) Reset()

Reset clears all the current graph data.

Package pagerank imports 1 packages (graph) and is imported by 4 packages. Updated 2020-01-06. Refresh now. Tools for package owners.