private static Double[][] initializeWeight(mxAnalysisGraph aGraph, Object[] nodes, Object[] edges, Map<Object, Integer> indexMap)
	{
		Double[][] weight = new Double[nodes.length][nodes.length];

		for (int i = 0; i < nodes.length; i++)
		{
			Arrays.fill(weight[i], Double.MAX_VALUE);
		}

		boolean isDirected = mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED);
		mxCostFunction costFunction = aGraph.getGenerator().getCostFunction();
		mxGraphView view = aGraph.getGraph().getView();

		for (Object currEdge : edges)
		{
			Object source = aGraph.getTerminal(currEdge, true);
			Object target = aGraph.getTerminal(currEdge, false);

			weight[indexMap.get(source)][indexMap.get(target)] = costFunction.getCost(view.getState(currEdge));

			if (!isDirected)
			{
				weight[indexMap.get(target)][indexMap.get(source)] = costFunction.getCost(view.getState(currEdge));
			}
		}

		for (int i = 0; i < nodes.length; i++)
		{
			weight[i][i] = 0.0;
		}

		return weight;
	};