AddVertex adds a vertex to the dag. AddVertex is not concurrent safe. All vertexes and edges are expected to be added synchronously before calling Run.
(work func(ctx context.Context) error, option ...VertexOption)
| 35 | // AddVertex adds a vertex to the dag. AddVertex is not concurrent safe. All |
| 36 | // vertexes and edges are expected to be added synchronously before calling Run. |
| 37 | func (d *DAG) AddVertex(work func(ctx context.Context) error, option ...VertexOption) VertexID { |
| 38 | id := len(d.vertexes) |
| 39 | d.vertexes = append(d.vertexes, newVertex(id, work, option...)) |
| 40 | return VertexID(id) |
| 41 | } |
| 42 | |
| 43 | // AddEdge adds an edge to the dag. AddEdge is not concurrent safe. All vertexes |
| 44 | // and edges are expected to be added synchronously before calling Run. |