changed graph and added socket.io support