Implement a simple adjacency list graph implementation. It is flexible to be both directed and undirected. Code in Java, JavaScript and Python.