private Graph<TypedVerTex, DefaultEdge> generateGraph(Tuple<double[][], String[][]> params) throws UserError {
		double[][] data1=params.getKey();
		//String [][]data2=params.getValue();

		int noTypes=(int)data1[0][0];
		int noNoRels=(int)data1[0][1];

		//------------
		BuildHeteGraph x=new BuildHeteGraph();
		List<InputPort> allPorts = this.getInputPorts().getAllPorts();
		if(allPorts.size()<2)
			throw new RuntimeException("invalid number of ports");

		//get all types port
		for (int i = 1; i <= noTypes; i++) {
			InputPort port=allPorts.get(i);
			if(port.isConnected()){
				ExampleSet exampleSet=port.getData(ExampleSet.class);
				String vertexType=exampleSet.getSource().replace("Retrieve ", "").trim();
				x.addVertex(exampleSet,ObjectTypeOfGraph.VERTEX,vertexType);
			}
		}

		//get All relation ports
		for (int i = noTypes+1; i <= noTypes+noNoRels; i++) {
			InputPort port=allPorts.get(i);
			if(port.isConnected()){
				ExampleSet exampleSet=port.getData(ExampleSet.class);
				String vertexType=exampleSet.getSource().replace("Retrieve ", "").trim();
				System.out.println("---reading relation exampleset "+vertexType);
				//tach ra 2 bang
				String []ss=vertexType.split("_");
				String fromType=ss[0];
				String toType=ss[1];
				//duyet du lieu
				Iterator<Example> itor = exampleSet.iterator();
				while(itor.hasNext()){
					Example ex = itor.next();
					Attributes atts = ex.getAttributes();
					Iterator<Attribute> it = atts.iterator();
					Attribute from=it.next();
					Attribute to=it.next();
					String fromVal=ex.getValueAsString(from);
					String toVal=ex.getValueAsString(to);
					TypedVerTex v1 = x.findVertex(fromVal, fromType);
					TypedVerTex v2 = x.findVertex(toVal, toType);
					//System.out.println(v1+";\t"+v2);
					if(v1!=null && v2!=null){
						//create state vertex and add to graph
						TypedVerTex state=new TypedVerTex("state", ex);
						x.addVertex(state);
						//add edge from v1->state
						x.addEdge(v1, state);
						//add edge from v2->state
						x.addEdge(v2, state);///state-->v2????
					}
				}
			}
		}
		return x.getGraph();
	}