// addEdge generates a graph edge in DOT format.
353753
func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) {
	var inline string
	if edge.Inline {
		inline = `\n (inline)`
	}
	w := b.config.FormatValue(edge.WeightValue())
	attr := fmt.Sprintf(`label=" %s%s"`, w, inline)
	if b.config.Total != 0 {
		// Note: edge.weight > b.config.Total is possible for profile diffs.
		if weight := 1 + int(min64(abs64(edge.WeightValue()*100/b.config.Total), 100)); weight > 1 {
			attr = fmt.Sprintf(`%s weight=%d`, attr, weight)
		}
		if width := 1 + int(min64(abs64(edge.WeightValue()*5/b.config.Total), 5)); width > 1 {
			attr = fmt.Sprintf(`%s penwidth=%d`, attr, width)
		}
		attr = fmt.Sprintf(`%s color="%s"`, attr,
			dotColor(float64(edge.WeightValue())/float64(abs64(b.config.Total)), false))
	}
	arrow := "->"
	if edge.Residual {
		arrow = "..."
	}
	tooltip := fmt.Sprintf(`"%s %s %s (%s)"`,
		edge.Src.Info.PrintableName(), arrow, edge.Dest.Info.PrintableName(), w)
	attr = fmt.Sprintf(`%s tooltip=%s labeltooltip=%s`, attr, tooltip, tooltip)

	if edge.Residual {
		attr = attr + ` style="dotted"`
	}

	if hasNodelets {
		// Separate children further if source has tags.
		attr = attr + " minlen=2"
	}

	fmt.Fprintf(b, "N%d -> N%d [%s]\n", from, to, attr)
}
1080156
func (n *Node) AddToEdgeDiv(to *Node, dv, v int64, residual, inline bool) {
	if n.Out[to] != to.In[n] {
		panic(fmt.Errorf("asymmetric edges %v %v", *n, *to))
	}

	if e := n.Out[to]; e != nil {
		e.WeightDiv += dv
		e.Weight += v
		if residual {
			e.Residual = true
		}
		if !inline {
			e.Inline = false
		}
		return
	}

	info := &Edge{Src: n, Dest: to, WeightDiv: dv, Weight: v, Residual: residual, Inline: inline}
	n.Out[to] = info
	to.In[n] = info
}
158469
func (gtidSet MariadbGTIDSet) AddGTID(other GTID) GTIDSet {
	mdbOther, ok := other.(MariadbGTID)
	if !ok || other == nil {
		return gtidSet
	}
	for i, gtid := range gtidSet {
		if mdbOther.Domain == gtid.Domain {
			if mdbOther.Sequence > gtid.Sequence {
				gtidSet[i] = mdbOther
			}
			return gtidSet
		}
	}
	return append(gtidSet, mdbOther)
}
472747
func (n *Node) AddToEdge(to *Node, v int64, residual, inline bool) {
	n.AddToEdgeDiv(to, 0, v, residual, inline)
}
1131754
func (it *Fixed) Add(v graph.Value) {
	it.values = append(it.values, v)
}
141803
func (mb *SquareMetrics) AddGauge(name string, callback func() int64) {
	mb.mutex.Lock()
	defer mb.mutex.Unlock()
	mb.gauges = append(mb.gauges, gaugeWithCallback{metrics.GetOrRegisterGauge(name, mb.Registry), callback})
}
498080
func AddImageStreamImageRefEdge(g osgraph.MutableUniqueGraph, node *imagegraph.ImageStreamImageNode) {
	dockImgRef, _ := reference.Parse(node.Name)
	imageStream := &imagev1.ImageStream{}
	imageStream.Namespace = node.Namespace
	imageStream.Name = dockImgRef.Name

	imageStreamNode := imagegraph.FindOrCreateSyntheticImageStreamNode(g, imageStream)
	g.AddEdge(node, imageStreamNode, ReferencedImageStreamImageGraphEdgeKind)
}
608127
func (g *BuilderGroup) AddGroup(info string) *BuilderGroup {
	return g.builder.AddGroup(info, g)
}
983873
func (g *Graph) Add(n interface{}) *Graph {

	if g == nil {
		return nil
	}

	if node, ok := n.(*Graph); ok && node != nil {
		g.Out = append(g.Out, node)
		return node
	}

	gg := Graph{n, nil}
	g.Out = append(g.Out, &gg)
	return &gg
}
41045
func (g *Generator) addType(t reflect.Type) {
	if g.typesSeen[t] {
		return
	}
	for _, t1 := range g.typesUnseen {
		if t1 == t {
			return
		}
	}
	g.typesUnseen = append(g.typesUnseen, t)
}
1128780
func (p *Polyline) AddNestedEntities(entities EntitySlice) {
	for _, entity := range entities {
		if vertex, ok := entity.(*Vertex); ok {
			p.Vertices = append(p.Vertices, vertex)
		} else {
			core.Log.Printf(
				"Skipping entity %v. Polylines can only contain Vertex entities.",
				entity)
		}
	}
}
606187
func (g *Mutable) AddCost(v, w int, c int64) {
	// Make sure not to break internal state.
	if w < 0 || w >= len(g.edges) {
		panic("vertex out of range: " + strconv.Itoa(w))
	}
	if g.edges[v] == nil {
		g.edges[v] = make(map[int]int64, initialMapSize)
	}
	g.edges[v][w] = c
}
95338
func AddBuildEdges(g osgraph.MutableUniqueGraph, node *buildgraph.BuildConfigNode) {
	for _, n := range g.(graph.Graph).Nodes() {
		if buildNode, ok := n.(*buildgraph.BuildNode); ok {
			if buildNode.Build.Namespace != node.BuildConfig.Namespace {
				continue
			}
			if belongsToBuildConfig(node.BuildConfig, buildNode.Build) {
				g.AddEdge(node, buildNode, BuildEdgeKind)
			}
		}
	}
}
634718
func (e *G1) Add(a, b *G1) *G1 {
	if e.p == nil {
		e.p = newCurvePoint(nil)
	}
	e.p.Add(a.p, b.p, new(bnPool))
	return e
}
1201578
func AddIntGauge(name string, tgs Tags) uint32 {
	id := atomic.AddUint32(curIntGaugeID, 1) - 1

	if id >= maxNumGauges {
		panic("Too many int gauges")
	}

	intgnames[id] = name

	tgs = copyTags(tgs)
	tgs[TagMetricType] = MetricTypeGauge
	tgs[TagDataType] = DataTypeUint64
	intgtags[id] = tgs

	return id
}
1253359
func AddAllExposedPodEdges(g osgraph.MutableUniqueGraph) {
	for _, node := range g.(graph.Graph).Nodes() {
		if serviceNode, ok := node.(*kubegraph.ServiceNode); ok {
			AddExposedPodEdges(g, serviceNode)
		}
	}
}
428113
func (s *storeMemoizer) NewGraph(ctx context.Context, id string) (storage.Graph, error) {
	g, err := s.s.NewGraph(ctx, id)
	if err != nil {
		return nil, err
	}
	return &graphMemoizer{
		g:    g,
		memN: make(map[string][]*node.Node),
		memP: make(map[string][]*predicate.Predicate),
		memO: make(map[string][]*triple.Object),
		memT: make(map[string][]*triple.Triple),
		memE: make(map[string]bool),
	}, nil
}