public void getKnightGraph(mxAnalysisGraph aGraph, int xDim, int yDim)
	{
		if (xDim < 3 || yDim < 3)
		{
			throw new IllegalArgumentException();
		}

		int numVertices = xDim * yDim;
		mxGraph graph = aGraph.getGraph();
		Object parent = graph.getDefaultParent();
		Object[] vertices = new Object[numVertices];
		
		for (int i = 0; i < numVertices; i++)
		{
			vertices[i] = graph.insertVertex(parent, null, new Integer(i).toString(), 0, 0, 25, 25);
		}

		//now we set up the starting conditions
		int[] currCoords = new int[2];

		//the main loop
		for (int i = 0; i < (xDim * yDim); i++)
		{
			currCoords = getVertexGridCoords(xDim, yDim, i);
			Object[] neighborMoves = getKnightMoveVertexes(aGraph, xDim, yDim, currCoords[0], currCoords[1]);

			for (int j = 0; j < neighborMoves.length; j++)
			{
				// connect current with the possible move that has minimum number of its (possible moves)
				if (!mxGraphStructure.areConnected(aGraph, vertices[i], neighborMoves[j]))
				{
					graph.insertEdge(parent, null, getNewEdgeValue(aGraph), vertices[i], neighborMoves[j]);
				}
				// that vertex becomes the current vertex and we repeat until no possible moves
			}
		}
	};