func (g *DirectedGraph) Edge(uid, vid int64) graph.Edge {
	edge, ok := g.from[uid][vid]
	if !ok {
		return nil
	}
	return 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.
package simple
import (
	"fmt"
	"gonum.org/v1/gonum/graph"
	"gonum.org/v1/gonum/graph/internal/uid"
	"gonum.org/v1/gonum/graph/iterator"
)
var (
	dg *DirectedGraph
	_ graph.Graph       = dg
	_ graph.Directed    = dg
	_ graph.NodeAdder   = dg
	_ graph.NodeRemover = dg
	_ graph.EdgeAdder   = dg
	_ graph.EdgeRemover = dg
)
type DirectedGraph struct {
	nodes map[int64]graph.Node
	from  map[int64]map[int64]graph.Edge
	to    map[int64]map[int64]graph.Edge
	nodeIDs uid.Set
}
func NewDirectedGraph() *DirectedGraph {
	return &DirectedGraph{
		nodes: make(map[int64]graph.Node),
		from:  make(map[int64]map[int64]graph.Edge),
		to:    make(map[int64]map[int64]graph.Edge),
		nodeIDs: uid.NewSet(),
	}
}
func (g *DirectedGraph) AddNode(n graph.Node) {
	if _, exists := g.nodes[n.ID()]; exists {
		panic(fmt.Sprintf("simple: node ID collision: %d", n.ID()))
	}
	g.nodes[n.ID()] = n
	g.from[n.ID()] = make(map[int64]graph.Edge)
	g.to[n.ID()] = make(map[int64]graph.Edge)
	g.nodeIDs.Use(n.ID())
}