public void addRow(String[] clusterNames, String[] nodeNames) {
		try {
			if (nodeNames.length != clusterNames.length) {
				throw new Exception(
						"The data size is unequal to the number of clusters.");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		// Add necessary nodes and clusters
		for (int i = 0; i < nodeNames.length; i++) {
			String nodeName = nodeNames[i];
			String clusterName = clusterNames[i];
			
			//if the cluster hasn't been seen before
			if (!clusters.keySet().contains(clusterName)) {
				Cluster cluster = new Cluster(clusterName);
				clusters.put(clusterName, cluster);
			}

			// If the node hasn't been seen before, i.e. if this data item does
			// not exist
			if (!nodes.keySet().contains(nodeName)) {
				Cluster cluster = clusters.get(clusterName);
				Node node = new Node(nodeName, clusterName);
				nodes.put(nodeName, node);
				cluster.put(node);
				ArrayList<Integer> al = new ArrayList<Integer>();
				connections.add(al); // Add a new node to connections
				for (int k = 0; k < nodeCount; k++) {
					al.add(0); //fill out the matrix row for the new node
				}
				for (ArrayList<Integer> arr : connections) {
					arr.add(0); // ensure that the array sizes are all equal
				}
				nodeCount++;
				nodeToIndex.put(nodeName, nodeCount - 1);
				indexToNode.put(nodeCount-1, nodeName);
			}
		}

		for (int i = 0; i < nodeNames.length; i++) {
			for (int j = i; j < nodeNames.length; j++) {
				int iIndex = nodeToIndex.get(nodeNames[i]);
				int jIndex = nodeToIndex.get(nodeNames[j]);
				//increment current connections between i and j
				int val = connections.get(iIndex).get(jIndex) + 1; 
				connections.get(iIndex).set(jIndex, val);
				//get the transpose also
				connections.get(jIndex).set(iIndex, val);
			}
		}
	}