Documentation
¶
Index ¶
- func QuoteIfNecessary(s string) string
- type AttributeError
- type Edge
- func (e *Edge) Destination() *Node
- func (e *Edge) Equals(other *Edge) bool
- func (e *Edge) Get(key string) string
- func (e *Edge) Name() string
- func (e *Edge) Sequence() int
- func (e *Edge) Set(key, value string) error
- func (e *Edge) SetAttribute(key, value string) *Edge
- func (e *Edge) SetSequence(seq int)
- func (e *Edge) Source() *Node
- func (e *Edge) String() string
- func (e *Edge) Type() string
- type Graph
- func (g *Graph) AddEdge(e *Edge)
- func (g *Graph) AddEdgeConcurrent(e *Edge)
- func (g *Graph) AddEdgeWithContext(ctx context.Context, e *Edge) error
- func (g *Graph) AddNode(n *Node)
- func (g *Graph) AddNodeConcurrent(n *Node)
- func (g *Graph) AddNodeWithContext(ctx context.Context, n *Node) error
- func (g *Graph) AddSubgraph(sg *SubGraph)
- func (g *Graph) AddSubgraphConcurrent(sg *SubGraph)
- func (g *Graph) AddSubgraphWithContext(ctx context.Context, sg *SubGraph) error
- func (g *Graph) ApplyLayout(layout string) error
- func (g *Graph) BFS(startNode string, visitor func(*Node))
- func (g *Graph) Clone() *Graph
- func (g *Graph) DFS(startNode string, visitor func(*Node))
- func (g *Graph) Diff(other *Graph) (*Graph, error)
- func (g *Graph) Equals(other *Graph) bool
- func (g *Graph) ExportDOT(w io.Writer) error
- func (g *Graph) ExportJSON(w io.Writer) error
- func (g *Graph) GetAverageDegree() float64
- func (g *Graph) GetDegree(nodeName string) int
- func (g *Graph) GetDensity() float64
- func (g *Graph) GetDiameter() int
- func (g *Graph) GetEdgeCount() int
- func (g *Graph) GetInDegree(nodeName string) int
- func (g *Graph) GetNodeCount() int
- func (g *Graph) GetOutDegree(nodeName string) int
- func (g *Graph) GetSubgraphCount() int
- func (g *Graph) GetSubgraphs() []*SubGraph
- func (g *Graph) MarshalJSON() ([]byte, error)
- func (g *Graph) Merge(other *Graph) error
- func (g *Graph) Optimize()
- func (g *Graph) RemoveEdge(src, dst string)
- func (g *Graph) RemoveNode(nodeName string)
- func (g *Graph) RemoveSubgraph(name string)
- func (g *Graph) SameRank(nodes []string)
- func (g *Graph) Set(key, value string) error
- func (g *Graph) SetAttribute(key, value string) *Graph
- func (g *Graph) SetGlobalEdgeAttr(key, value string) error
- func (g *Graph) SetGlobalEdgeAttribute(key, value string) *Graph
- func (g *Graph) SetGlobalNodeAttr(key, value string) error
- func (g *Graph) SetGlobalNodeAttribute(key, value string) *Graph
- func (g *Graph) SetStrict(strict bool) *Graph
- func (g *Graph) SetType(t GraphType) *Graph
- func (g *Graph) ShortestPath(start, end *Node) ([]*Node, error)
- func (g *Graph) String() string
- func (g *Graph) ToPNG(filename string) error
- func (g *Graph) ToSVG(filename string) error
- func (g *Graph) TopologicalSort() ([]*Node, error)
- func (g *Graph) UnmarshalJSON(data []byte) error
- func (g *Graph) Validate() error
- type GraphObject
- type GraphType
- type Item
- type Node
- func (n *Node) Equals(other *Node) bool
- func (n *Node) Get(key string) string
- func (n *Node) Name() string
- func (n *Node) Sequence() int
- func (n *Node) Set(key, value string) error
- func (n *Node) SetAttribute(key, value string) *Node
- func (n *Node) SetSequence(seq int)
- func (n *Node) String() string
- func (n *Node) Type() string
- type PriorityQueue
- type Sequenceable
- type SubGraph
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QuoteIfNecessary ¶
Types ¶
type AttributeError ¶
Error type for invalid attributes
func (AttributeError) Error ¶
func (e AttributeError) Error() string
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
func (*Edge) Destination ¶
func (*Edge) SetAttribute ¶
func (*Edge) SetSequence ¶
type Graph ¶
func NewGraph ¶
Example ¶
package main
import (
"fmt"
"github.com/tmc/dot"
)
func main() {
g := dot.NewGraph("G")
g.Set("label", "Example graph")
n1, n2 := dot.NewNode("Node1"), dot.NewNode("Node2")
n1.Set("color", "sienna")
g.AddNode(n1)
g.AddNode(n2)
e := dot.NewEdge(n1, n2)
e.Set("dir", "both")
g.AddEdge(e)
fmt.Println(g)
}
Output: digraph G { graph [ label="Example graph"; ]; Node1 [color=sienna]; Node2; Node1 -> Node2 [ dir=both ] }
func (*Graph) AddEdgeConcurrent ¶
func (*Graph) AddEdgeWithContext ¶
func (*Graph) AddNodeConcurrent ¶
func (*Graph) AddNodeWithContext ¶
func (*Graph) AddSubgraph ¶
func (*Graph) AddSubgraphConcurrent ¶
func (*Graph) AddSubgraphWithContext ¶
func (*Graph) ApplyLayout ¶
func (*Graph) GetAverageDegree ¶
func (*Graph) GetDensity ¶
func (*Graph) GetDiameter ¶
func (*Graph) GetEdgeCount ¶
func (*Graph) GetInDegree ¶
func (*Graph) GetNodeCount ¶
func (*Graph) GetOutDegree ¶
func (*Graph) GetSubgraphCount ¶
func (*Graph) GetSubgraphs ¶
func (*Graph) MarshalJSON ¶
func (*Graph) RemoveEdge ¶
func (*Graph) RemoveNode ¶
func (*Graph) RemoveSubgraph ¶
func (*Graph) SetAttribute ¶
func (*Graph) SetGlobalEdgeAttr ¶
func (*Graph) SetGlobalEdgeAttribute ¶
func (*Graph) SetGlobalNodeAttr ¶
func (*Graph) SetGlobalNodeAttribute ¶
func (*Graph) TopologicalSort ¶
func (*Graph) UnmarshalJSON ¶
type GraphObject ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) SetAttribute ¶
func (*Node) SetSequence ¶
type PriorityQueue ¶
type PriorityQueue []*Item
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
func (*PriorityQueue) Update ¶
func (pq *PriorityQueue) Update(item *Item)
type Sequenceable ¶
type SubGraph ¶
type SubGraph struct {
Graph
// contains filtered or unexported fields
}
func NewSubgraph ¶
func (*SubGraph) SetSequence ¶
Click to show internal directories.
Click to hide internal directories.