Add function for checking if a node with a given id exists

This commit is contained in:
Robert Machmer 2015-12-24 03:24:40 +01:00
parent ebb82093fb
commit 729afd59af

View File

@ -155,6 +155,14 @@ function Graph.new()
end
end
---
-- Checks if the id points to an existing node.
-- @param id - The id to check for.
--
function self:exists( id )
return nodes[id] ~= nil;
end
---
-- This function receives a single parameter of type function to which it
-- will pass the edges and nodes tables. This means the user has to provide