layout

package
v2.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package layout is the port through which the workspace graph is placed for drawing. The engine asks a Layout where each node goes and every interface draws what it is told, so the graph looks the same in each; the force adapter beside this package is the one implementation today.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	S, T int
}

Edge joins two nodes, by their index in the nodes passed.

type Func

type Func func(nodes []Node, edges []Edge) []Point

Func adapts a function to the Layout interface.

func (Func) Place

func (f Func) Place(nodes []Node, edges []Edge) []Point

Place calls f.

type Layout

type Layout interface {
	// Place returns one point per node, in the order of nodes.
	Place(nodes []Node, edges []Edge) []Point
}

Layout places a graph. The same nodes and edges in the same order are always placed the same way, so a graph asked for twice, or by two interfaces, is drawn alike.

type Node

type Node struct {
	// Group gathers nodes that belong together (the engine passes a
	// kind's place in its order); a layout keeps a group near itself.
	Group int
}

Node is one thing to place.

type Point

type Point struct {
	X, Y float64
}

Point is where a node goes, in units an interface scales to its screen.

Directories

Path Synopsis
Package conformance is what every layout.Layout must do: place every node somewhere finite, the same way every time, keep what is connected nearer than what is not, and keep a group together.
Package conformance is what every layout.Layout must do: place every node somewhere finite, the same way every time, keep what is connected nearer than what is not, and keep a group together.
Package force is a force-directed Layout: edges are springs, nodes push apart at short range, and each group drifts towards its own place on a ring, so the same kinds gather and a node sits between what it connects.
Package force is a force-directed Layout: edges are springs, nodes push apart at short range, and each group drifts towards its own place on a ring, so the same kinds gather and a node sits between what it connects.
Package layered is a Layout for a directed acyclic graph: each group is a layer, drawn as a band from the top down in the order the engine numbers them, so every edge runs from a band to one above it or along its own.
Package layered is a Layout for a directed acyclic graph: each group is a layer, drawn as a band from the top down in the order the engine numbers them, so every edge runs from a band to one above it or along its own.

Jump to

Keyboard shortcuts

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