go-nettle

module
v0.0.0-...-eededc5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT

README

go-nettle

Go Report Card

A foray into graph layout algorithms with golang. Implements the Barycentric Method described here.

Install

go get github.com/JohnCoene/go-nettle/nettle

Example

package main

import (
	"fmt"
	"go-nettle/nettle"
)

func main() {

	var nodes = []string{"India", "Canada", "Japan"}

	edges := make([]nettle.Edge, 3)
	edges[0] = nettle.Edge{
		Source: "India",
		Target: "Canada",
	}
	edges[1] = nettle.Edge{
		Source: "Canada",
		Target: "Japan",
	}
	edges[2] = nettle.Edge{
		Source: "Japan",
		Target: "India",
	}

	g := nettle.Graph{
		Nodes: nodes,
		Edges: edges,
	}

	gl := g.CreateGraph()

	gl = nettle.Layout(100, 100, 1, 5, gl)

	fmt.Println(gl)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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