Documentation
¶
Overview ¶
Package graph provides interfaces and basic representations for graphs.
Sub-packages provide common graph algorithms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BiGraph ¶
BiGraph extends Graph to graphs that represent both out-edges and in-edges.
func MakeBiGraph ¶
MakeBiGraph constructs a BiGraph from what may be a unidirectional Graph. If g is already a BiGraph, this returns g.
type Edge ¶
Edge identifies an edge in a graph. Given Graph g, Edge e represents edge g.Out(e.Node)[e.Edge].
type Graph ¶
type Graph interface {
// NumNodes returns the number of nodes in this graph.
NumNodes() int
// Out returns the nodes to which node i points.
Out(i int) []int
}
Graph represents a directed graph. The nodes of the graph must be densely numbered starting at 0.
type IntGraph ¶
type IntGraph [][]int
IntGraph is a basic Graph g where g[i] is the list of out-edge indexes of node i.
type Subgraph ¶
type Subgraph interface {
Graph
// Underlying returns the underlying graph that this is a
// subgraph of.
Underlying() Graph
// NodeMap transduces a node property map on the underlying
// graph into a node property map on this graph.
NodeMap(underlyingMap func(node int) interface{}) func(node int) interface{}
// EdgeMap transduces an edge property map on the underlying
// graph into an edge property map on this graph.
EdgeMap(underlyingMap func(node, edge int) interface{}) func(node, edge int) interface{}
}
A Subgraph is a Graph that consists of a subset of the nodes and vertices from another, underlying Graph.
func SubgraphKeep ¶
SubgraphKeep returns a subgraph of g that keeps the given nodes and edges. Subgraph node i corresponds to nodes[i] in g.
type Weighted ¶
type Weighted interface {
Graph
// OutWeight returns the weight of the e'th edge out from node
// i. e must be in the range [0, len(Out(i))).
OutWeight(i, e int) float64
}
Weighted represented a weighted directed graph.
type WeightedUnit ¶
type WeightedUnit struct {
Graph
}
WeightedUnit wraps a graph as a weighted graph where all edges have weight 1.
func (WeightedUnit) OutWeight ¶
func (w WeightedUnit) OutWeight(i, e int) float64
OutWeight returns 1.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package graphalg implements common graph algorithms.
|
Package graphalg implements common graph algorithms. |
|
Package graphout implements functions to write graphs to common graph formats.
|
Package graphout implements functions to write graphs to common graph formats. |