graph

package
v0.0.0-...-b5dce0d Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: BSD-3-Clause, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From string `json:"v"`
	To   string `json:"w"`
}

Edge is Graph's edge

type Graph

type Graph struct {
	Nodes   []Node  `json:"nodes"`
	Edges   []Edge  `json:"edges"`
	Options Options `json:"options"`
}

Graph is graph that when marshaled to JSON can be imported via Graphlib JS pkg from NPM

func (Graph) SortedNodeNames

func (g Graph) SortedNodeNames() []string

SortedNodeNames returns a sorted list of all the node names

func (Graph) ToDOT

func (g Graph) ToDOT() string

ToDOT return graph as GraphViz .dot format string

type Node

type Node struct {
	Name  string      `json:"v"`
	Value interface{} `json:"value"`
}

Node is Grpah's node

type Options

type Options struct {
	Directed   bool `json:"directed"`
	Multigraph bool `json:"multigraph"`
	Compound   bool `json:"compound"`
}

Options is Graph's options

Jump to

Keyboard shortcuts

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