Skip to content

JohnCoene/go-nettle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

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)
}

Releases

No releases published

Packages

No packages published

Languages