spectral

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Overview

Package spectral provides graph spectral analysis functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Laplacian

type Laplacian struct {
	// Matrix holds the Laplacian matrix.
	mat.Matrix

	// Nodes holds the input graph nodes.
	Nodes []graph.Node

	// Index is a mapping from the graph
	// node IDs to row and column indices.
	Index map[int64]int
}

Laplacian is a graph Laplacian matrix.

func NewLaplacian

func NewLaplacian(g graph.Undirected) Laplacian

NewLaplacian returns a Laplacian matrix for the simple undirected graph g. The Laplacian is defined as D-A where D is a diagonal matrix holding the degree of each node and A is the graph adjacency matrix of the input graph. If g contains self edges, NewLaplacian will panic.

func NewRandomWalkLaplacian

func NewRandomWalkLaplacian(g graph.Graph, damp float64) Laplacian

NewRandomWalkLaplacian returns a damp-scaled random walk Laplacian matrix for the simple graph g. The random walk Laplacian is defined as I-D^(-1)A where D is a diagonal matrix holding the degree of each node and A is the graph adjacency matrix of the input graph. If g contains self edges, NewRandomWalkLaplacian will panic.

func NewSymNormLaplacian

func NewSymNormLaplacian(g graph.Undirected) Laplacian

NewSymNormLaplacian returns a symmetric normalized Laplacian matrix for the simple undirected graph g. The normalized Laplacian is defined as I-D^(-1/2)AD^(-1/2) where D is a diagonal matrix holding the degree of each node and A is the graph adjacency matrix of the input graph. If g contains self edges, NewSymNormLaplacian will panic.

Jump to

Keyboard shortcuts

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