graphviz

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: ISC Imports: 1 Imported by: 0

README

graphviz

Documentation

Overview

Package graphviz can be used for creating Graphviz graphs and DOT language codes.

Deprecated: this package has been frozen and deprecated in favor of github.com/moorara/algo/pkg/graphviz

Index

Constants

View Source
const (
	EdgeTypeDirected   = "->"
	EdgeTypeUndirected = "--"

	EdgeDirNone    = "none"
	EdgeDirForward = "forward"
	EdgeDirBack    = "back"
	EdgeDirBoth    = "both"

	ColorBlack       = "black"
	ColorWhite       = "white"
	ColorGray        = "gray"
	ColorRed         = "red"
	ColorCoral       = "coral"
	ColorOrange      = "orange"
	ColorOrangeRed   = "orangered"
	ColorGold        = "gold"
	ColorYellow      = "yellow"
	ColorYellowGreen = "yellowgreen"
	ColorGreen       = "green"
	ColorLimeGreen   = "limegreen"
	ColorSeaGreen    = "seagreen"
	ColorBlue        = "blue"
	ColorNavy        = "navy"
	ColorPurple      = "purple"
	ColorSkyBlue     = "skyblue"
	ColorRoyalBlue   = "royalblue"
	ColorSteelBlue   = "steelblue"
	ColorTan         = "tan"
	ColorPink        = "pink"
	ColorOrchid      = "orchid"

	StyleSolid   = "solid"
	StyleBold    = "bold"
	StyleFilled  = "filled"
	StyleDashed  = "dashed"
	StyleDotted  = "dotted"
	StyleRounded = "rounded"

	ShapeNode     = "none"
	ShapePoint    = "point"
	ShapePlain    = "plain"
	ShapeCircle   = "circle"
	ShapeOval     = "oval"
	ShapeBox      = "box"
	ShapeSquare   = "sqaure"
	ShapeDiamond  = "diamond"
	ShapeTriangle = "triangle"
	ShapeRecord   = "record"
	ShapeMrecord  = "Mrecord"

	RankSame = "same"
	RankMin  = "min"
	RankMax  = "max"

	RankdirTB = "TB"
	RankdirLR = "LR"
	RankdirRL = "RL"
	RankdirBT = "BT"

	ArrowheadNone     = "none"
	ArrowheadNormal   = "normal"
	ArrowheadEmpty    = "empty"
	ArrowheadOpen     = "open"
	ArrowheadDot      = "dot"
	ArrowheadOdot     = "odot"
	ArrowheadBox      = "box"
	ArrowheadObox     = "obox"
	ArrowheadDiamond  = "diamond"
	ArrowheadOdiamond = "odiamond"
	ArrowheadEdiamond = "ediamond"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	From      string
	To        string
	EdgeType  string
	EdgeDir   string
	Label     string
	Color     string
	Style     string
	Arrowhead string
}

Edge represents a graph edge for visualization

func NewEdge

func NewEdge(from, to, edgeType, edgeDir, label, color, style, arrowhead string) Edge

NewEdge creates a new edge for visualization

func (*Edge) DotCode

func (e *Edge) DotCode() string

DotCode generates Graph dot language code for edge

type Graph

type Graph struct {
	Strict    bool
	Digraph   bool
	Name      string
	Rankdir   string
	NodeColor string
	NodeStyle string
	NodeShape string
	Nodes     []Node
	Edges     []Edge
	Subgraphs []Subgraph
}

Graph represents a graph for visualization

func NewGraph

func NewGraph(strict, digraph bool, name, rankdir, nodeColor, nodeStyle, nodeShape string) Graph

NewGraph creates a new graph for visualization

func (*Graph) AddEdge

func (g *Graph) AddEdge(edges ...Edge)

AddEdge adds a new edge to graph for visualization

func (*Graph) AddNode

func (g *Graph) AddNode(nodes ...Node)

AddNode adds a new node to graph for visualization

func (*Graph) AddSubgraph

func (g *Graph) AddSubgraph(subgraphs ...Subgraph)

AddSubgraph adds a new subgraph to graph for visualization

func (*Graph) DotCode

func (g *Graph) DotCode() string

DotCode generates Graph dot language code for graph

type Node

type Node struct {
	Name      string
	Group     string
	Label     string
	Color     string
	Style     string
	Shape     string
	FontColor string
	FontName  string
}

Node represents a graph node for visualization

func NewNode

func NewNode(name, group, label, color, style, shape, fontcolor, fontname string) Node

NewNode creates a new node for visualization

func (*Node) DotCode

func (n *Node) DotCode() string

DotCode generates Graph dot language code for node

type Subgraph

type Subgraph struct {
	Name      string
	Label     string
	Color     string
	Style     string
	Rank      string
	Rankdir   string
	NodeColor string
	NodeStyle string
	NodeShape string
	Nodes     []Node
	Edges     []Edge
	Subgraphs []Subgraph
}

Subgraph represents a subgraph for visualization

func NewSubgraph

func NewSubgraph(name, label, color, style, rank, rankdir, nodeColor, nodeStyle, nodeShape string) Subgraph

NewSubgraph creates a new subgraph for visualization

func (*Subgraph) AddEdge

func (s *Subgraph) AddEdge(edges ...Edge)

AddEdge adds a new edge to graph for visualization

func (*Subgraph) AddNode

func (s *Subgraph) AddNode(nodes ...Node)

AddNode adds a new node to graph for visualization

func (*Subgraph) AddSubgraph

func (s *Subgraph) AddSubgraph(subgraphs ...Subgraph)

AddSubgraph adds a new subgraph to graph for visualization

func (*Subgraph) DotCode

func (s *Subgraph) DotCode(indent int) string

DotCode generates Graph dot language code for subgraph

Jump to

Keyboard shortcuts

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