code: public static <K, VV, EV> Graph<K, VV, EV> fromDataSet(DataSet<Edge<K, EV>> edges,
  			final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
  
  		TypeInformation<K> keyType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(0);
  
  		TypeInformation<VV> valueType = TypeExtractor.createTypeInfo(
  				MapFunction.class, vertexValueInitializer.getClass(), 1, keyType, null);
  
  		@SuppressWarnings({ "unchecked", "rawtypes" })
  		TypeInformation<Vertex<K, VV>> returnType = (TypeInformation<Vertex<K, VV>>) new TupleTypeInfo(
  				Vertex.class, keyType, valueType);
  
  		DataSet<Vertex<K, VV>> vertices = edges
  			.flatMap(new EmitSrcAndTargetAsTuple1<>())
  				.name("Source and target IDs")
  			.distinct()
  				.name("IDs")
  			.map(new MapFunction<Tuple1<K>, Vertex<K, VV>>() {
  				private Vertex<K, VV> output = new Vertex<>();
  
  				public Vertex<K, VV> map(Tuple1<K> value) throws Exception {
  					output.f0 = value.f0;
  					output.f1 = vertexValueInitializer.map(value.f0);
  					return output;
  				}
  			}).returns(returnType).withForwardedFields("f0").name("Initialize vertex values");
  
  		return new Graph<>(vertices, edges, context);
  	}
docs: Creates a graph from a DataSet of edges.
  Vertices are created automatically and their values are set
  by applying the provided map function to the vertex IDs.
  
  @param edges a DataSet of edges.
  @param vertexValueInitializer the mapper function that initializes the vertex values.
  It allows to apply a map transformation on the vertex ID to produce an initial vertex value.
  @param context the flink execution environment.
  @return the newly created graph.