cleaned up in graph
cleaned up in network

- fixed a bug
- added comments