Documentation ¶
Index ¶
- func FormatAdjacency(g Graph) string
- func FormatGrid(g Graph) string
- func FormatGridLabeled(g Graph, labels []string) string
- func FormatList(g Graph) string
- func FormatMatrix(g Graph) string
- type Graph
- type Graph16
- func (g Graph16) Add(i, j uint)
- func (g Graph16) AddUndirected(i, j uint)
- func (g Graph16) Clear(i, j uint)
- func (g Graph16) Copy() Graph
- func (g Graph16) Has(i, j uint) bool
- func (g Graph16) InDegree(i uint) int
- func (g Graph16) Len() int
- func (g Graph16) OutDegree(i uint) int
- func (g Graph16) Reverse() Graph
- func (g Graph16) String() string
- func (g Graph16) Swap(i, j uint)
- type Graph8
- func (g *Graph8) Add(i, j uint)
- func (g *Graph8) AddUndirected(i, j uint)
- func (g *Graph8) Clear(i, j uint)
- func (g *Graph8) Copy() Graph
- func (g *Graph8) Has(i, j uint) bool
- func (g *Graph8) InDegree(i uint) int
- func (g *Graph8) Len() int
- func (g *Graph8) OutDegree(i uint) int
- func (g *Graph8) Reverse() Graph
- func (g *Graph8) String() string
- func (g *Graph8) Swap(i, j uint)
- type GraphN
- func (g *GraphN) Add(i, j uint)
- func (g *GraphN) AddUndirected(i, j uint)
- func (g *GraphN) Clear(i, j uint)
- func (g *GraphN) Copy() Graph
- func (g *GraphN) Has(i, j uint) bool
- func (g *GraphN) InDegree(i uint) int
- func (g *GraphN) Len() int
- func (g *GraphN) OutDegree(i uint) int
- func (g GraphN) Reverse() Graph
- func (g *GraphN) String() string
- func (g *GraphN) Swap(i, j uint)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAdjacency ¶
FormatAdjacency formats the graph as an adjacency list on multiple lines.
func FormatGrid ¶
FormatGrid formats the graph as a grid on multiple lines.
func FormatGridLabeled ¶
FormatGridLabeled formats a graph as an ASCII grid with row and column labels.
func FormatList ¶
FormatList formats the graph as a list of edges on a single line.
func FormatMatrix ¶
FormatMatrix formats a graph as a matrix on multiple lines using extending Unicode brackets.
Types ¶
type Graph ¶
type Graph interface { Add(i, j uint) AddUndirected(i, j uint) Clear(i, j uint) Swap(i, j uint) Has(i, j uint) bool Copy() Graph Reverse() Graph OutDegree(i uint) int InDegree(i uint) int Len() int String() string }
Graph is a directed graph.
func Generate ¶
Generate generates all possible directed graphs of a maximum rank starting with a given empty graph.
func GenerateUndirected ¶
GenerateUndirected generates all possible undirected graphs of a maximum rank starting with a given empty graph.
type Graph16 ¶
type Graph16 []uint16
Graph16 is a directed graph with at most 16 nodes.
func NewGraph16 ¶
NewGraph16 constructs a graph with a given number of nodes.
func (Graph16) AddUndirected ¶
AddUndirected adds an undirected edge between nodes i and j.
type Graph8 ¶
type Graph8 struct {
// contains filtered or unexported fields
}
Graph8 is a directed graph with 8 nodes with operations in constant time.
func (*Graph8) AddUndirected ¶
AddUndirected adds an undirected edge between nodes i and j.
type GraphN ¶
type GraphN struct {
// contains filtered or unexported fields
}
GraphN is a directed graph with an arbitrary number of nodes.
func (*GraphN) AddUndirected ¶
AddUndirected adds an undirected edge between nodes i and j.