More efficient adjacency matrix constructor, parameter for is_directed

Also adds a test