gonum: gonum.org/v1/gonum/graph/iterator Index | Files

package iterator

import "gonum.org/v1/gonum/graph/iterator"

Package iterator provides node, edge and line iterators.

The iterators provided satisfy the graph.Nodes, graph.Edges and graph.Lines interfaces.

Index

Package Files

doc.go edges.go lines.go nodes.go nodes_unordered.go

type ImplicitNodes Uses

type ImplicitNodes struct {
    // contains filtered or unexported fields
}

ImplicitNodes implements the graph.Nodes interface for a set of nodes over a contiguous ID range.

func NewImplicitNodes Uses

func NewImplicitNodes(beg, end int, new func(id int) graph.Node) *ImplicitNodes

NewImplicitNodes returns a new implicit node iterator spanning nodes in [beg,end). The provided new func maps the id to a graph.Node. NewImplicitNodes will panic if beg is greater than end.

func (*ImplicitNodes) Len Uses

func (n *ImplicitNodes) Len() int

Len returns the remaining number of nodes to be iterated over.

func (*ImplicitNodes) Next Uses

func (n *ImplicitNodes) Next() bool

Next returns whether the next call of Node will return a valid node.

func (*ImplicitNodes) Node Uses

func (n *ImplicitNodes) Node() graph.Node

Node returns the current node of the iterator. Next must have been called prior to a call to Node.

func (*ImplicitNodes) NodeSlice Uses

func (n *ImplicitNodes) NodeSlice() []graph.Node

NodeSlice returns all the remaining nodes in the iterator and advances the iterator.

func (*ImplicitNodes) Reset Uses

func (n *ImplicitNodes) Reset()

Reset returns the iterator to its initial state.

type Nodes Uses

type Nodes struct {
    // contains filtered or unexported fields
}

Nodes implements the graph.Nodes interfaces. The iteration order of Nodes is randomized.

func NewNodes Uses

func NewNodes(nodes map[int64]graph.Node) *Nodes

NewNodes returns a Nodes initialized with the provided nodes, a map of node IDs to graph.Nodes. No check is made that the keys match the graph.Node IDs, and the map keys are not used.

Behavior of the Nodes is unspecified if nodes is mutated after the call the NewNodes.

func (*Nodes) Len Uses

func (n *Nodes) Len() int

Len returns the remaining number of nodes to be iterated over.

func (*Nodes) Next Uses

func (n *Nodes) Next() bool

Next returns whether the next call of Node will return a valid node.

func (*Nodes) Node Uses

func (n *Nodes) Node() graph.Node

Node returns the current node of the iterator. Next must have been called prior to a call to Node.

func (*Nodes) Reset Uses

func (n *Nodes) Reset()

Reset returns the iterator to its initial state.

type OrderedEdges Uses

type OrderedEdges struct {
    // contains filtered or unexported fields
}

OrderedEdges implements the graph.Edges and graph.EdgeSlicer interfaces. The iteration order of OrderedEdges is the order of edges passed to NewEdgeIterator.

func NewOrderedEdges Uses

func NewOrderedEdges(edges []graph.Edge) *OrderedEdges

NewOrderedEdges returns an OrderedEdges initialized with the provided edges.

func (*OrderedEdges) Edge Uses

func (e *OrderedEdges) Edge() graph.Edge

Edge returns the current edge of the iterator. Next must have been called prior to a call to Edge.

func (*OrderedEdges) EdgeSlice Uses

func (e *OrderedEdges) EdgeSlice() []graph.Edge

EdgeSlice returns all the remaining edges in the iterator and advances the iterator.

func (*OrderedEdges) Len Uses

func (e *OrderedEdges) Len() int

Len returns the remaining number of edges to be iterated over.

func (*OrderedEdges) Next Uses

func (e *OrderedEdges) Next() bool

Next returns whether the next call of Edge will return a valid edge.

func (*OrderedEdges) Reset Uses

func (e *OrderedEdges) Reset()

Reset returns the iterator to its initial state.

type OrderedLines Uses

type OrderedLines struct {
    // contains filtered or unexported fields
}

OrderedLines implements the graph.Lines and graph.LineSlicer interfaces. The iteration order of OrderedLines is the order of lines passed to NewLineIterator.

func NewOrderedLines Uses

func NewOrderedLines(lines []graph.Line) *OrderedLines

NewOrderedLines returns an OrderedLines initialized with the provided lines.

func (*OrderedLines) Len Uses

func (e *OrderedLines) Len() int

Len returns the remaining number of lines to be iterated over.

func (*OrderedLines) Line Uses

func (e *OrderedLines) Line() graph.Line

Line returns the current line of the iterator. Next must have been called prior to a call to Line.

func (*OrderedLines) LineSlice Uses

func (e *OrderedLines) LineSlice() []graph.Line

LineSlice returns all the remaining lines in the iterator and advances the iterator.

func (*OrderedLines) Next Uses

func (e *OrderedLines) Next() bool

Next returns whether the next call of Line will return a valid line.

func (*OrderedLines) Reset Uses

func (e *OrderedLines) Reset()

Reset returns the iterator to its initial state.

type OrderedNodes Uses

type OrderedNodes struct {
    // contains filtered or unexported fields
}

OrderedNodes implements the graph.Nodes and graph.NodeSlicer interfaces. The iteration order of OrderedNodes is the order of nodes passed to NewNodeIterator.

func NewOrderedNodes Uses

func NewOrderedNodes(nodes []graph.Node) *OrderedNodes

NewOrderedNodes returns a OrderedNodes initialized with the provided nodes.

func (*OrderedNodes) Len Uses

func (n *OrderedNodes) Len() int

Len returns the remaining number of nodes to be iterated over.

func (*OrderedNodes) Next Uses

func (n *OrderedNodes) Next() bool

Next returns whether the next call of Node will return a valid node.

func (*OrderedNodes) Node Uses

func (n *OrderedNodes) Node() graph.Node

Node returns the current node of the iterator. Next must have been called prior to a call to Node.

func (*OrderedNodes) NodeSlice Uses

func (n *OrderedNodes) NodeSlice() []graph.Node

NodeSlice returns all the remaining nodes in the iterator and advances the iterator.

func (*OrderedNodes) Reset Uses

func (n *OrderedNodes) Reset()

Reset returns the iterator to its initial state.

type OrderedWeightedEdges Uses

type OrderedWeightedEdges struct {
    // contains filtered or unexported fields
}

OrderedWeightedEdges implements the graph.Edges and graph.EdgeSlicer interfaces. The iteration order of OrderedWeightedEdges is the order of edges passed to NewEdgeIterator.

func NewOrderedWeightedEdges Uses

func NewOrderedWeightedEdges(edges []graph.WeightedEdge) *OrderedWeightedEdges

NewOrderedWeightedEdges returns an OrderedWeightedEdges initialized with the provided edges.

func (*OrderedWeightedEdges) Len Uses

func (e *OrderedWeightedEdges) Len() int

Len returns the remaining number of edges to be iterated over.

func (*OrderedWeightedEdges) Next Uses

func (e *OrderedWeightedEdges) Next() bool

Next returns whether the next call of WeightedEdge will return a valid edge.

func (*OrderedWeightedEdges) Reset Uses

func (e *OrderedWeightedEdges) Reset()

Reset returns the iterator to its initial state.

func (*OrderedWeightedEdges) WeightedEdge Uses

func (e *OrderedWeightedEdges) WeightedEdge() graph.WeightedEdge

WeightedEdge returns the current edge of the iterator. Next must have been called prior to a call to WeightedEdge.

func (*OrderedWeightedEdges) WeightedEdgeSlice Uses

func (e *OrderedWeightedEdges) WeightedEdgeSlice() []graph.WeightedEdge

WeightedEdgeSlice returns all the remaining edges in the iterator and advances the iterator.

type OrderedWeightedLines Uses

type OrderedWeightedLines struct {
    // contains filtered or unexported fields
}

OrderedWeightedLines implements the graph.Lines and graph.LineSlicer interfaces. The iteration order of OrderedWeightedLines is the order of lines passed to NewLineIterator.

func NewOrderedWeightedLines Uses

func NewOrderedWeightedLines(lines []graph.WeightedLine) *OrderedWeightedLines

NewWeightedLineIterator returns an OrderedWeightedLines initialized with the provided lines.

func (*OrderedWeightedLines) Len Uses

func (e *OrderedWeightedLines) Len() int

Len returns the remaining number of lines to be iterated over.

func (*OrderedWeightedLines) Next Uses

func (e *OrderedWeightedLines) Next() bool

Next returns whether the next call of WeightedLine will return a valid line.

func (*OrderedWeightedLines) Reset Uses

func (e *OrderedWeightedLines) Reset()

Reset returns the iterator to its initial state.

func (*OrderedWeightedLines) WeightedLine Uses

func (e *OrderedWeightedLines) WeightedLine() graph.WeightedLine

WeightedLine returns the current line of the iterator. Next must have been called prior to a call to WeightedLine.

func (*OrderedWeightedLines) WeightedLineSlice Uses

func (e *OrderedWeightedLines) WeightedLineSlice() []graph.WeightedLine

WeightedLineSlice returns all the remaining lines in the iterator and advances the iterator.

Package iterator imports 2 packages (graph) and is imported by 19 packages. Updated 2019-07-24. Refresh now. Tools for package owners.