public MyGraph(Collection<Vertex> v, Collection<Edge> e) {
		checkNull(v, "vertices");
		checkNull(e, "edges");
		graph = new HashMap<Vertex, Set<Edge>>();
		for (Vertex vertex : v)
			graph.put(vertex, new HashSet<Edge>());
		for (Edge edge : e) {
			if (!graph.containsKey(edge.getSource()) || !graph.containsKey(edge.getDestination()))
				throw new IllegalArgumentException(edge + " either comes from or goes to " +
						"a nonexistent vertex");
			if (edge.getWeight() < 0)
				throw new IllegalArgumentException(edge + " has negative weight; not allowed");
			for (Edge otherEdge : e) /* two edges from vertices p to q with different weights
												 	 not allowed */
				if (edge.getSource().equals(otherEdge.getSource()) && 
				edge.getDestination().equals(otherEdge.getDestination())
				&& edge.getWeight() != otherEdge.getWeight())
					throw new IllegalArgumentException(edge + " and " + otherEdge + " are the " +
							"same except for their weights; not allowed.");
			graph.get(edge.getSource()).add(edge);
		}
	}