func (g *dataDirected) ArcsTo(v Vertex, f ArcStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	if !g.hasVertex(v) {
		return
	}
	for candidate, adjacent := range g.list {
		for target, data := range adjacent {
			if target == v {
				if f(NewDataArc(candidate, target, data)) {
					return
				}
			}
		}
	}
}
Enumerates the set of in-edges for the provided vertex.
package al
import (
	"sync"
	. "github.com/sdboyer/gogl"
	"gopkg.in/fatih/set.v0"
)
type baseData struct {
	list map[Vertex]map[Vertex]interface{}
	size int
	mu   sync.RWMutex
}
func (g *baseData) Vertices(f VertexStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	for v := range g.list {
		if f(v) {
			return
		}
	}
}
func (g *baseData) HasVertex(vertex Vertex) (exists bool) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	exists = g.hasVertex(vertex)
	return
}
func (g *baseData) hasVertex(vertex Vertex) (exists bool) {
	_, exists = g.list[vertex]
	return
}
func (g *baseData) Order() int {
	g.mu.RLock()
	defer g.mu.RUnlock()
	return len(g.list)
}
func (g *baseData) Size() int {
	return g.size
}
func (g *baseData) EnsureVertex(vertices ...Vertex) {
	if len(vertices) == 0 {
		return
	}
	g.mu.Lock()
	defer g.mu.Unlock()
	g.ensureVertex(vertices...)
}
func (g *baseData) ensureVertex(vertices ...Vertex) {
	for _, vertex := range vertices {
		if !g.hasVertex(vertex) {
			g.list[vertex] = make(map[Vertex]interface{}, 10)
		}
	}
	return
}
type dataDirected struct {
	baseData
}
func (g *dataDirected) OutDegreeOf(vertex Vertex) (degree int, exists bool) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	if exists = g.hasVertex(vertex); exists {
		degree = len(g.list[vertex])
	}
	return
}
func (g *dataDirected) InDegreeOf(vertex Vertex) (degree int, exists bool) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	return inDegreeOf(g, vertex)
}
func (g *dataDirected) DegreeOf(vertex Vertex) (degree int, exists bool) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	indegree, exists := inDegreeOf(g, vertex)
	outdegree, exists := g.OutDegreeOf(vertex)
	return indegree + outdegree, exists
}
func (g *dataDirected) IncidentTo(v Vertex, f EdgeStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	eachEdgeIncidentToDirected(g, v, f)
}
func (g *dataDirected) AdjacentTo(start Vertex, f VertexStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	g.IncidentTo(start, func(e Edge) bool {
		u, v := e.Both()
		if u == start {
			return f(v)
		} else {
			return f(u)
		}
	})
}
func (g *dataDirected) ArcsFrom(v Vertex, f ArcStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	if !g.hasVertex(v) {
		return
	}
	for adjacent, data := range g.list[v] {
		if f(NewDataArc(v, adjacent, data)) {
			return
		}
	}
}
func (g *dataDirected) SuccessorsOf(v Vertex, f VertexStep) {
	g.mu.RLock()
	defer g.mu.RUnlock()
	eachVertexInAdjacencyList(g.list, v, f)
}