diff options
| author | ruki <[email protected]> | 2025-03-27 00:41:57 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-04-08 15:31:55 +0800 |
| commit | 4fee5fe56d3eedb3871ee237b083bb3bcbf6ec5c (patch) | |
| tree | c381d54e4344939c3e078dce5f175dcc34ae6553 /xmake/core/base/graph.lua | |
| parent | 01733eaae58b4aec4374868bcab18ee8c95c56ae (diff) | |
fix jobgraph for isolated vertex
Diffstat (limited to 'xmake/core/base/graph.lua')
| -rw-r--r-- | xmake/core/base/graph.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/xmake/core/base/graph.lua b/xmake/core/base/graph.lua index 658b71e73..43b43ce3c 100644 --- a/xmake/core/base/graph.lua +++ b/xmake/core/base/graph.lua @@ -94,6 +94,17 @@ function graph:has_vertex(v) return table.contains(self:vertices(), v) end +-- add an isolated without edges +function graph:add_vertex(v) + if not self:has_vertex(v) then + table.insert(self._vertices, v) + self._adjacent_edges[v] = {} + end + + -- reset partial topological sort state since graph structure changed + self._partial_topo_dirty = true +end + -- remove the given vertex? function graph:remove_vertex(v) local contains = false |
