Documentation ¶
Overview ¶
Package simple holds a very simple graph structure suitable to receive an onnx model
Index ¶
- func GetOrderedChildren(g graph.WeightedDirected, n graph.Node) *iterator.OrderedNodes
- type Graph
- func (g *Graph) AddNode(n graph.Node)
- func (g *Graph) ApplyOperation(_ onnx.Operation, _ ...graph.Node) error
- func (g *Graph) DOTAttributers() (graph, node, edge encoding.Attributer)
- func (g *Graph) Edge(uid, vid int64) graph.Edge
- func (g *Graph) From(id int64) graph.Nodes
- func (g *Graph) HasEdgeBetween(xid, yid int64) bool
- func (g *Graph) HasEdgeFromTo(uid, vid int64) bool
- func (g *Graph) NewNode() graph.Node
- func (g *Graph) NewWeightedEdge(from, to graph.Node, w float64) graph.WeightedEdge
- func (g *Graph) Node(id int64) graph.Node
- func (g *Graph) Nodes() graph.Nodes
- func (g *Graph) SetWeightedEdge(e graph.WeightedEdge)
- func (g *Graph) To(id int64) graph.Nodes
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOrderedChildren ¶
func GetOrderedChildren(g graph.WeightedDirected, n graph.Node) *iterator.OrderedNodes
GetOrderedChildren returns an iterator of children nodes ordered by the weighted edges
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a simple directed graph
func (*Graph) AddNode ¶
AddNode adds n to the graph. It panics if the added node ID matches an existing node ID.
func (*Graph) ApplyOperation ¶
ApplyOperation to fulfil the OperationCarrier interface
func (*Graph) DOTAttributers ¶
func (g *Graph) DOTAttributers() (graph, node, edge encoding.Attributer)
DOTAttributers is used for representation in graphviz
func (*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 (*Graph) HasEdgeBetween ¶
HasEdgeBetween returns whether an edge exists between nodes x and y without considering direction.
func (*Graph) HasEdgeFromTo ¶
HasEdgeFromTo returns whether an edge exists in the graph from u to v.
func (*Graph) NewNode ¶
NewNode returns a new unique Node to be added to g. The Node's ID does not become valid in g until the Node is added to g.
func (*Graph) NewWeightedEdge ¶
NewWeightedEdge returns a new weighted edge from the source to the destination node.
func (*Graph) Node ¶
Node returns the node with the given ID if it exists in the graph, and nil otherwise.
func (*Graph) SetWeightedEdge ¶
func (g *Graph) SetWeightedEdge(e graph.WeightedEdge)
SetWeightedEdge adds a weighted edge from one node to another. If the nodes do not exist, they are added and are set to the nodes of the edge otherwise. It will panic if the IDs of the e.From and e.To are equal.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node of the graph
func (*Node) ApplyTensor ¶
ApplyTensor to fulfil the TensorCarrier interface
func (*Node) Attributes ¶
Attributes it a method to fulfil the encoding/dot package
func (*Node) GetDescription ¶
GetDescription to fulfil the Namer interface
func (*Node) SetDescription ¶
SetDescription to fulfil the Namer interface