graphlayout

package module
v0.0.0-...-3231420 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 5 Imported by: 0

README

graphlayout

Build Status GoDoc

A Go library for computing graph layouts.

graphlayout

Usage

import (
  "github.com/lytics/graphlayout"
  "gonum.org/v1/gonum/mat"
)

// adjacency matrix
var adj *mat.DenseMatrix
stop := make(chan struct{})
layout, err := graphlayout.FruchtermanReingoldLayout(adj, stop, &FruchtermanReingoldConfig{
  Niter: 1000,
})

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMatrixAymmetric = errors.New("matrix not symmetric")
	ErrMatrixEmpty     = errors.New("matrix not symmetric")
	ErrNoEdges         = errors.New("graph contains no edges")
)
View Source
var (
	ErrSimulationStopped = errors.New("layout simulation stopped")
)

Functions

func FruchtermanReingoldLayout

func FruchtermanReingoldLayout(matrix *mat.Dense, stop <-chan struct{}, conf *FruchtermanReingoldConfig) (*mat.Dense, error)

Types

type FruchtermanReingoldConfig

type FruchtermanReingoldConfig struct {
	// number of simulation iterations to run
	Niter int

	// maximum change in position for any iteration
	MaxDelta float64

	// size of space to explore
	Area float64

	// cooling exponent for annealing
	CoolExp float64

	// radius at which vertex/vertex repulsion cancels out attraction
	// of adjacent vertices
	RepulseRad float64

	// to speed calculations on large graphs, the plot region is divided at each
	// iteration into `ncell`x`ncell` "cells", which are used to define
	// neighborhoods and force calculation. moderate numbers of cells result in
	// fastest calculations. too few can look odd, and too many can take too long
	Ncells float64

	// cell jitter: factor (in units of cell width) used in assigning vertices
	// to cells.  small values may generate "grid-like" anomalies for graphs
	// with many isolates
	CellJitter float64

	// cell pointpointrad: square "radius" (in units of cells) such that exact
	// point interaction calculations are used for all vertices belonging to any
	// two cells less than or equal to this distance apart.  higher values
	// approximate the true F/R solution, but increases computational cost.
	CPPR float64

	// cell pointcellrad: squared "radius" (in units of cells) such that approximate
	// point/cell interaction calculations are used for all vertices belonging to
	// two cells less than or equal to this distance apart (and not within the
	// point/point radius). higher values provide somewhat better approximations
	// to the true F/R solution at slightly increased computational cost.
	CPCR float64

	// cell cellcellrad: squared "radius" (in units of cells) such that the approximate
	// cell/cell interactino calculations are used for all vertices belonging to
	// any two cells less than or equal to this distance apart (and not within the
	// point/point or point/cell radii). higher values provide somewhat better
	// approximations to the true F/R solution at slightly increased computational
	// cost.  note that cells beyond this radius (if any) do not interact, save
	// through edge attraction.
	CCCR float64
}

type GraphRenderer

type GraphRenderer func(*mat.Dense, interface{}, <-chan struct{}) (*mat.Dense, error) // adjacency to xy coords

Jump to

Keyboard shortcuts

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