add sql-based method for determining graph nodes.