kubernetes: k8s.io/kubernetes/third_party/forked/gonum/graph/simple Index | Files

package simple

import "k8s.io/kubernetes/third_party/forked/gonum/graph/simple"

Package simple provides a suite of simple graph implementations satisfying the gonum/graph interfaces.

Index

Package Files

directed_acyclic.go edgeholder.go simple.go undirected.go

type DirectedAcyclicGraph Uses

type DirectedAcyclicGraph struct {
    *UndirectedGraph
}

DirectedAcyclicGraph implements graph.Directed using UndirectedGraph, which only stores one edge for any node pair.

func NewDirectedAcyclicGraph Uses

func NewDirectedAcyclicGraph(self, absent float64) *DirectedAcyclicGraph

func (*DirectedAcyclicGraph) From Uses

func (g *DirectedAcyclicGraph) From(n graph.Node) []graph.Node

func (*DirectedAcyclicGraph) HasEdgeFromTo Uses

func (g *DirectedAcyclicGraph) HasEdgeFromTo(u, v graph.Node) bool

func (*DirectedAcyclicGraph) To Uses

func (g *DirectedAcyclicGraph) To(n graph.Node) []graph.Node

func (*DirectedAcyclicGraph) VisitFrom Uses

func (g *DirectedAcyclicGraph) VisitFrom(n graph.Node, visitor func(neighbor graph.Node) (shouldContinue bool))

func (*DirectedAcyclicGraph) VisitTo Uses

func (g *DirectedAcyclicGraph) VisitTo(n graph.Node, visitor func(neighbor graph.Node) (shouldContinue bool))

type Edge Uses

type Edge struct {
    F, T graph.Node
    W    float64
}

Edge is a simple graph edge.

func (Edge) From Uses

func (e Edge) From() graph.Node

From returns the from-node of the edge.

func (Edge) To Uses

func (e Edge) To() graph.Node

To returns the to-node of the edge.

func (Edge) Weight Uses

func (e Edge) Weight() float64

Weight returns the weight of the edge.

type Node Uses

type Node int

Node is a simple graph node.

func (Node) ID Uses

func (n Node) ID() int

ID returns the ID number of the node.

type UndirectedGraph Uses

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

UndirectedGraph implements a generalized undirected graph.

func NewUndirectedGraph Uses

func NewUndirectedGraph(self, absent float64) *UndirectedGraph

NewUndirectedGraph returns an UndirectedGraph with the specified self and absent edge weight values.

func (*UndirectedGraph) AddNode Uses

func (g *UndirectedGraph) AddNode(n graph.Node)

AddNode adds n to the graph. It panics if the added node ID matches an existing node ID.

func (*UndirectedGraph) Degree Uses

func (g *UndirectedGraph) Degree(n graph.Node) int

Degree returns the degree of n in g.

func (*UndirectedGraph) Edge Uses

func (g *UndirectedGraph) Edge(u, v graph.Node) graph.Edge

Edge returns the edge from u to v if such an edge exists and nil otherwise. The node v must be directly reachable from u as defined by the From method.

func (*UndirectedGraph) EdgeBetween Uses

func (g *UndirectedGraph) EdgeBetween(x, y graph.Node) graph.Edge

EdgeBetween returns the edge between nodes x and y.

func (*UndirectedGraph) Edges Uses

func (g *UndirectedGraph) Edges() []graph.Edge

Edges returns all the edges in the graph.

func (*UndirectedGraph) From Uses

func (g *UndirectedGraph) From(n graph.Node) []graph.Node

From returns all nodes in g that can be reached directly from n.

func (*UndirectedGraph) Has Uses

func (g *UndirectedGraph) Has(n graph.Node) bool

Has returns whether the node exists within the graph.

func (*UndirectedGraph) HasEdgeBetween Uses

func (g *UndirectedGraph) HasEdgeBetween(x, y graph.Node) bool

HasEdgeBetween returns whether an edge exists between nodes x and y.

func (*UndirectedGraph) NewNodeID Uses

func (g *UndirectedGraph) NewNodeID() int

NewNodeID returns a new unique ID for a node to be added to g. The returned ID does not become a valid ID in g until it is added to g.

func (*UndirectedGraph) Node Uses

func (g *UndirectedGraph) Node(id int) graph.Node

Node returns the node in the graph with the given ID.

func (*UndirectedGraph) Nodes Uses

func (g *UndirectedGraph) Nodes() []graph.Node

Nodes returns all the nodes in the graph.

func (*UndirectedGraph) RemoveEdge Uses

func (g *UndirectedGraph) RemoveEdge(e graph.Edge)

RemoveEdge removes e from the graph, leaving the terminal nodes. If the edge does not exist it is a no-op.

func (*UndirectedGraph) RemoveNode Uses

func (g *UndirectedGraph) RemoveNode(n graph.Node)

RemoveNode removes n from the graph, as well as any edges attached to it. If the node is not in the graph it is a no-op.

func (*UndirectedGraph) SetEdge Uses

func (g *UndirectedGraph) SetEdge(e graph.Edge)

SetEdge adds e, an edge from one node to another. If the nodes do not exist, they are added. It will panic if the IDs of the e.From and e.To are equal.

func (*UndirectedGraph) Weight Uses

func (g *UndirectedGraph) Weight(x, y graph.Node) (w float64, ok bool)

Weight returns the weight for the edge between x and y if Edge(x, y) returns a non-nil Edge. If x and y are the same node or there is no joining edge between the two nodes the weight value returned is either the graph's absent or self value. Weight returns true if an edge exists between x and y or if x and y have the same ID, false otherwise.

Package simple imports 4 packages (graph) and is imported by 1 packages. Updated 2018-04-20. Refresh now. Tools for package owners.