From 4fee5fe56d3eedb3871ee237b083bb3bcbf6ec5c Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 27 Mar 2025 00:41:57 +0800 Subject: fix jobgraph for isolated vertex --- xmake/core/base/graph.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'xmake/core/base/graph.lua') 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 -- cgit v1.3.1