MCPcopy Create free account
hub / github.com/google/pprof / AddToEdgeDiv

Method AddToEdgeDiv

internal/graph/graph.go:128–148  ·  view source on GitHub ↗

AddToEdgeDiv increases the weight of an edge between two nodes. If there isn't such an edge one is created.

(to *Node, dv, v int64, residual, inline bool)

Source from the content-addressed store, hash-verified

126// AddToEdgeDiv increases the weight of an edge between two nodes. If
127// there isn't such an edge one is created.
128func (n *Node) AddToEdgeDiv(to *Node, dv, v int64, residual, inline bool) {
129 if n.Out[to] != to.In[n] {
130 panic(fmt.Errorf("asymmetric edges %v %v", *n, *to))
131 }
132
133 if e := n.Out[to]; e != nil {
134 e.WeightDiv += dv
135 e.Weight += v
136 if residual {
137 e.Residual = true
138 }
139 if !inline {
140 e.Inline = false
141 }
142 return
143 }
144
145 info := &Edge{Src: n, Dest: to, WeightDiv: dv, Weight: v, Residual: residual, Inline: inline}
146 n.Out[to] = info
147 to.In[n] = info
148}
149
150// NodeInfo contains the attributes for a node.
151type NodeInfo struct {

Callers 3

AddToEdgeMethod · 0.95
newGraphFunction · 0.95
newTreeFunction · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected