Documentation
¶
Overview ¶
Package graph provides a simple adjacency map graph for network-graph.
Index ¶
- func Save(g *Graph) (string, error)
- type Graph
- func (g *Graph) AddEdge(from, to node.ID) error
- func (g *Graph) AddNode(id node.ID) error
- func (g *Graph) EdgeCount() int
- func (g *Graph) HasEdge(from, to node.ID) bool
- func (g *Graph) HasNode(id node.ID) bool
- func (g *Graph) Hash() string
- func (g *Graph) IsBidirectional() bool
- func (g *Graph) Neighbors(id node.ID) []node.ID
- func (g *Graph) Nodes() []node.ID
- func (g *Graph) RemoveEdge(from, to node.ID) error
- func (g *Graph) RemoveNode(id node.ID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph maintains nodes and adjacency edges.
func FromMatrix ¶
FromMatrix creates a new graph from a boolean adjacency matrix.
func (*Graph) AddEdge ¶
AddEdge adds an edge from -> to. If bidirectional is true, adds the reverse edge as well.
func (*Graph) IsBidirectional ¶
IsBidirectional returns true if the graph is bidirectional.
func (*Graph) RemoveEdge ¶
RemoveEdge removes the edge from -> to. If bidirectional is true, removes the reverse edge as well.
Click to show internal directories.
Click to hide internal directories.