Fixing graph algorithm, adding .gitignore for .pyc files.