Add setters for replacing the default Edge and Node classes

This can be handy if the user wants to extend the functionality of those
classes. They can simply be inherited in a new class with that new class
being used in the Graph then.
This commit is contained in:
Robert Machmer 2016-01-09 05:06:54 +01:00
parent 73b74ca3fe
commit 7901ac1381

View File

@ -242,4 +242,20 @@ function Graph.new()
return self; return self;
end end
---
-- Replaces the default Edge class with a custom one.
-- @param class - The custom Edge class to use.
--
function Graph.setEdgeClass( class )
Edge = class;
end
---
-- Replaces the default Node class with a custom one.
-- @param class - The custom Node class to use.
--
function Graph.setNodeClass( class )
Node = class;
end
return Graph; return Graph;