@ SuppressWarnings ( { "serial" , "unchecked" } ) public < K , VV > Graph < K , VV , NullValue > vertexTypes ( Class < K > vertexKey , Class < VV > vertexValue ) { if ( edgeReader == null ) { throw new RuntimeException ( "The edge input file cannot be null!" ) ; } DataSet < Edge < K , NullValue > > edges = edgeReader . types ( vertexKey , vertexKey ) . name ( GraphCsvReader . class . getName ( ) ) . map ( new Tuple2ToEdgeMap <> ( ) ) . name ( "To Edge" ) ; // the vertex value can be provided by an input file or a user-defined mapper if ( vertexReader != null ) { DataSet < Vertex < K , VV > > vertices = vertexReader . types ( vertexKey , vertexValue ) . name ( GraphCsvReader . class . getName ( ) ) . map ( new Tuple2ToVertexMap <> ( ) ) . name ( "Type conversion" ) ; return Graph . fromDataSet ( vertices , edges , executionContext ) ; } else if ( mapper != null ) { return Graph . fromDataSet ( edges , ( MapFunction < K , VV > ) mapper , executionContext ) ; } else { throw new RuntimeException ( "Vertex values have to be specified through a vertices input file" + "or a user-defined map function." ) ; } }
Creates a Graph from CSV input without edge values . The vertex values are specified through a vertices input file or a user - defined map function . If no vertices input file is provided the vertex IDs are automatically created from the edges input file .