trying a different approach
trying networkx
new non OO version due to inheritance issue; debugging code