refactored from_node and from_rel to base class