private static String[][] parseStringArray(DynamicArray<String> matrix) {
        if (matrix.get(0).toLowerCase().equals("directed")) {
            matrix.delete(0);
            directed = true;
        } else {
            directed = false;
        }
        String[][] adjacencyMatrix = new String[matrix.getSize()][matrix.getSize()];
        for (int i = 0; i < matrix.getSize(); i++) {
            String[] parsedString = matrix.get(i).split("\\s+");
            for (int j = 0; j < parsedString.length; j++) {
                adjacencyMatrix[i][j] = parsedString[j];
            }
        }
        return adjacencyMatrix;
    }