MCPcopy Index your code
hub / github.com/gonum/plot / graphFrom

Function graphFrom

plotter/contour.go:575–595  ·  view source on GitHub ↗

graphFrom returns a graph representing the point path p.

(p path)

Source from the content-addressed store, hash-verified

573
574// graphFrom returns a graph representing the point path p.
575func graphFrom(p path) graph {
576 g := make([]set, len(p))
577 seen := make(map[point]int)
578 for i, v := range p {
579 if _, ok := seen[v]; !ok {
580 seen[v] = i
581 }
582 }
583
584 for i, v := range p {
585 e, ok := seen[v]
586 if ok && g[e] == nil {
587 g[e] = make(set)
588 }
589 if i < len(p)-1 {
590 g[e][seen[p[i+1]]] = struct{}{}
591 }
592 }
593
594 return g
595}
596
597// subpath returns a subpath given the slice of point indices
598// into the path.

Callers 3

TestTarjanFunction · 0.85
TestJohnsonFunction · 0.85
exciseLoopsMethod · 0.85

Calls

no outgoing calls

Tested by 2

TestTarjanFunction · 0.68
TestJohnsonFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…