Roots returns the slice of "Roots" of the graph
()
| 348 | |
| 349 | // Roots returns the slice of "Roots" of the graph |
| 350 | func (g *Graph) Roots() []*Vertex { |
| 351 | g.lock.Lock() |
| 352 | defer g.lock.Unlock() |
| 353 | |
| 354 | var res []*Vertex |
| 355 | for _, v := range g.Vertices { |
| 356 | if len(v.Parents) == 0 { |
| 357 | res = append(res, v) |
| 358 | } |
| 359 | } |
| 360 | return res |
| 361 | } |
| 362 | |
| 363 | // UpdateStatus updates the status of a certain vertex |
| 364 | func (g *Graph) UpdateStatus(key string, status ServiceStatus) { |